@ontemper/edi 1.1.2-beta.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93,8 +93,14 @@ class TemperEdiClient {
|
|
|
93
93
|
message: 'Unauthorized access to EDI service. Reach out to support.',
|
|
94
94
|
code: 'edi_unauthorized_error',
|
|
95
95
|
});
|
|
96
|
+
// Gateway normalises EdiFabric's camelCase to PascalCase before forwarding
|
|
96
97
|
const responseData = error.response?.data;
|
|
97
|
-
const details = responseData
|
|
98
|
+
const details = typeof responseData === 'object' &&
|
|
99
|
+
responseData !== null &&
|
|
100
|
+
'Details' in responseData &&
|
|
101
|
+
Array.isArray(responseData.Details)
|
|
102
|
+
? responseData.Details
|
|
103
|
+
: undefined;
|
|
98
104
|
const message = error.response?.status === 400 && details?.length
|
|
99
105
|
? `EDI validation failed: ${details.join('; ')}`
|
|
100
106
|
: responseData && typeof responseData === 'object'
|