ebay-api 9.4.3 → 9.4.4

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.
@@ -73,9 +73,12 @@ export type EBayRestfulError = {
73
73
  inputRefIds?: any[];
74
74
  httpStatusCode: number;
75
75
  };
76
- export type EBayRestfulErrorResponse = {
76
+ export type EBayRestfulErrorsResponse = {
77
77
  errors: EBayRestfulError[];
78
78
  };
79
+ export type EBayRestfulErrorResponse = {
80
+ error: EBayRestfulError[];
81
+ };
79
82
  export type EBaySimpleError = {
80
83
  message: string;
81
84
  description?: string;
@@ -89,7 +92,7 @@ export type EBayOAuthErrorResponse = {
89
92
  error: string;
90
93
  error_description?: string;
91
94
  };
92
- export type EBayApiErrorResponse = string | EBayPostOrderErrorResponse | EBayRestfulErrorResponse | EBayTraditionalErrorResponse | EBayOAuthErrorResponse;
95
+ export type EBayApiErrorResponse = string | EBayPostOrderErrorResponse | EBayRestfulErrorsResponse | EBayRestfulErrorResponse | EBayTraditionalErrorResponse | EBayOAuthErrorResponse;
93
96
  export type ApiRequestResult = {
94
97
  response: {
95
98
  data?: EBayApiErrorResponse;
@@ -94,12 +94,15 @@ function getEBayError(data) {
94
94
  if ('error' in data && typeof data.error === 'string') {
95
95
  return {
96
96
  message: data.error,
97
- description: data.error_description || ''
97
+ description: 'error_description' in data ? data.error_description || '' : ''
98
98
  };
99
99
  }
100
100
  if ('errors' in data && Array.isArray(data.errors)) {
101
101
  return data.errors[0];
102
102
  }
103
+ if ('error' in data && Array.isArray(data.error)) {
104
+ return data.error[0];
105
+ }
103
106
  if ('errorMessage' in data) {
104
107
  return Array.isArray(data.errorMessage?.error) ? data.errorMessage.error[0] : data.errorMessage.error;
105
108
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ebay-api",
3
3
  "author": "Daniil Tomilow",
4
- "version": "9.4.3",
4
+ "version": "9.4.4",
5
5
  "description": "eBay API for Node and Browser",
6
6
  "type": "module",
7
7
  "main": "./lib/index.js",