@vasrefil/api-toolkit 1.0.50 → 1.0.51
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/env.d.ts
CHANGED
package/dist/env.js
CHANGED
|
@@ -15,6 +15,7 @@ const env = {
|
|
|
15
15
|
API_KEY: process.env.API_KEY,
|
|
16
16
|
SERVICE_NAME: process.env.SERVICE_NAME,
|
|
17
17
|
REDIS_URL: process.env.REDIS_URL,
|
|
18
|
+
ERROR_MESSAGE: 'Sorry an error occured, please try again later',
|
|
18
19
|
VASREFIL: {
|
|
19
20
|
BASEURL: NODE_ENV === NODE_ENVS.PROD ? 'https://api.vasrefil.com' : 'https://api-v2-test.vasrefil.com',
|
|
20
21
|
API_KEY: process.env.VASREFIL_API_KEY
|
|
@@ -111,12 +111,16 @@ class RootService {
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
get_error(error) {
|
|
114
|
-
let response = { status: status_interface_1.Status.ERROR, message:
|
|
115
|
-
const { status, message, data } = error;
|
|
114
|
+
let response = { status: status_interface_1.Status.ERROR, message: env_1.default.ERROR_MESSAGE, data: null, code: null };
|
|
115
|
+
const { status, message, data, code } = error;
|
|
116
116
|
response.status = status ? status : response.status;
|
|
117
|
+
response.code = code ? code : response.code;
|
|
117
118
|
if (!(error instanceof mongoose.Error)) {
|
|
118
119
|
response.message = message ? message : response.message;
|
|
119
120
|
}
|
|
121
|
+
if (error?.codeName) {
|
|
122
|
+
response.message = env_1.default.ERROR_MESSAGE;
|
|
123
|
+
}
|
|
120
124
|
response.data = data ? data : response.data;
|
|
121
125
|
return response;
|
|
122
126
|
}
|