@vasrefil/api-toolkit 1.3.2 → 1.3.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.
|
@@ -120,6 +120,7 @@ class RootService {
|
|
|
120
120
|
const { status, message, data, code } = error;
|
|
121
121
|
response.status = status ? status : response.status;
|
|
122
122
|
response.code = code ? code : response.code;
|
|
123
|
+
response.data = data ? data : response.data;
|
|
123
124
|
if (!(error instanceof mongoose.Error)) {
|
|
124
125
|
response.message = message ? message : response.message;
|
|
125
126
|
}
|
|
@@ -129,13 +130,12 @@ class RootService {
|
|
|
129
130
|
if (['invalid signature', 'jwt expired'].includes(response.message)) {
|
|
130
131
|
response.message = 'Authentication failed. Please log in again.';
|
|
131
132
|
}
|
|
132
|
-
if (message
|
|
133
|
+
if (message?.includes('authorization header')) {
|
|
133
134
|
response.message = 'Authorization failed.';
|
|
134
135
|
}
|
|
135
|
-
if (message
|
|
136
|
+
if (message?.includes('ETIMEDOUT')) {
|
|
136
137
|
response.message = env_1.default.ERROR_MESSAGE;
|
|
137
138
|
}
|
|
138
|
-
response.data = data ? data : response.data;
|
|
139
139
|
return response;
|
|
140
140
|
}
|
|
141
141
|
getHttpStatus(status) {
|