@@ -82,8 +82,9 @@ public function init() {
82
82
*
83
83
* @return bool
84
84
*
85
- * @throws Exception PHP Exception.
86
- * @throws PinterestApiException Pinterest API Exception.
85
+ * @throws PinterestApiLocaleException Pinterest API does not support the locale.
86
+ * @throws PinterestApiException Pinterest API exception.
87
+ * @throws Throwable Any other exception.
87
88
*/
88
89
public function handle_feed_registration (): bool {
89
90
@@ -97,26 +98,19 @@ public function handle_feed_registration(): bool {
97
98
}
98
99
99
100
try {
100
- if ( self ::register_feed () ) {
101
- return true ;
102
- }
103
- throw new Exception ( esc_html__ ( 'Could not register feed. ' , 'pinterest-for-woocommerce ' ) );
101
+ return self ::register_feed ();
104
102
} catch ( PinterestApiLocaleException $ e ) {
105
103
Pinterest_For_Woocommerce ()::save_data ( 'merchant_locale_not_valid ' , true );
106
104
107
105
// translators: %s: Error message.
108
- $ error_message = "Could not register feed. Error: {$ e ->getMessage ()}" ;
106
+ $ error_message = "Could not register the feed. Error: {$ e ->getMessage ()}" ;
109
107
self ::log ( $ error_message , 'error ' );
110
- return false ;
108
+ throw $ e ;
111
109
} catch ( PinterestApiException $ e ) {
112
110
throw $ e ;
113
111
} catch ( Throwable $ th ) {
114
- if ( method_exists ( $ th , 'get_pinterest_code ' ) && 4163 === $ th ->get_pinterest_code () ) {
115
- Pinterest_For_Woocommerce ()::save_data ( 'merchant_connected_diff_platform ' , true );
116
- }
117
-
118
112
self ::log ( $ th ->getMessage (), 'error ' );
119
- return false ;
113
+ throw $ th ;
120
114
}
121
115
}
122
116
0 commit comments