@@ -81,9 +81,9 @@ const findBrandBySlug = async (appSdk, storeId, slug) => {
81
81
err . request = err . request ?. config
82
82
err . response = err . response ?. data
83
83
logger . error ( err )
84
- if ( error && error . response ) {
84
+ /* if (error && error.response) {
85
85
logger.error({ data: error.response.data })
86
- }
86
+ } */
87
87
throw error
88
88
}
89
89
}
@@ -114,9 +114,9 @@ const getBrand = async (appSdk, storeId, feedProduct) => {
114
114
err . request = err . request ?. config
115
115
err . response = err . response ?. data
116
116
logger . error ( err )
117
- if ( error && error . response ) {
117
+ /* if (error && error.response) {
118
118
logger.error({ data: error.response.data })
119
- }
119
+ } */
120
120
throw error
121
121
}
122
122
}
@@ -342,11 +342,15 @@ const saveEcomProduct = async (appSdk, appData, storeId, feedProduct, variations
342
342
343
343
return ecomResponse
344
344
} catch ( error ) {
345
- if ( error && error . response ) {
345
+ const err = new Error ( error . message )
346
+ err . request = err . request ?. config
347
+ err . response = err . response ?. data
348
+ logger . error ( err )
349
+ /* if (error && error.response) {
346
350
meta.responseError = { data: error.response.data || '', config: error.response.config || '' }
347
351
logger.error({ data: error.response.data })
348
352
}
349
- meta . responseError = { error : error . toString ( ) }
353
+ meta.responseError = { error: error.toString() } */
350
354
throw error
351
355
}
352
356
}
@@ -367,9 +371,13 @@ const saveEcomVariations = async (appSdk, appData, storeId, variations, product)
367
371
368
372
await appSdk . apiRequest ( parseInt ( storeId ) , `/products/${ product . _id } .json` , 'PATCH' , { variations : parsedVariations } )
369
373
} catch ( error ) {
370
- if ( error && error . response ) {
374
+ const err = new Error ( error . message )
375
+ err . request = err . request ?. config
376
+ err . response = err . response ?. data
377
+ logger . error ( err )
378
+ /* if (error && error.response) {
371
379
logger.error({ data: error.response.data })
372
- }
380
+ } */
373
381
throw error
374
382
}
375
383
}
@@ -394,9 +402,13 @@ const saveEcomImages = async (appSdk, storeId, productId, imageLinks) => {
394
402
}
395
403
await appSdk . apiRequest ( parseInt ( storeId ) , resource , 'PATCH' , { pictures } )
396
404
} catch ( error ) {
397
- if ( error && error . response ) {
405
+ const err = new Error ( error . message )
406
+ err . request = err . request ?. config
407
+ err . response = err . response ?. data
408
+ logger . error ( err )
409
+ /* if (error && error.response) {
398
410
logger.error({ data: error.response.data })
399
- }
411
+ } */
400
412
throw error
401
413
}
402
414
}
0 commit comments