Skip to content

Commit 0d49145

Browse files
fix when the invoker experience 404 it throws empty error (#415)
* fixed the not found status Signed-off-by: pathan salman khan <[email protected]> * fixed the pretty Signed-off-by: pathan salman khan <[email protected]> * fixed 404 error Signed-off-by: pathan salman khan <[email protected]> Signed-off-by: pathan salman khan <[email protected]> Co-authored-by: pathan salman khan <[email protected]>
1 parent 636af92 commit 0d49145

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/implementation/Client/HTTPClient/HTTPClient.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,17 @@ export default class HTTPClient implements IClient {
203203
if (res.status >= 200 && res.status <= 399) {
204204
return txtParsed;
205205
}
206-
// 400 = Bad Request, 401 = Unauthorized, 404 = Not Found
207-
else if (res.status === 400 || res.status === 401 || res.status === 404) {
208-
throw new Error(JSON.stringify(txtParsed));
209-
}
210-
// 403 = Forbidden
211-
else if (res.status === 403) {
212-
throw new Error(JSON.stringify(txtParsed));
213-
}
214-
// 500 = Internal Server Error, 502 = Bad Gateway
215-
else if (res.status === 500 || res.status === 502) {
216-
throw new Error(JSON.stringify(txtParsed));
217-
}
206+
218207
// All the others
219208
else {
220-
this.logger.debug("Execute response text: %s", txtParsed);
209+
this.logger.debug(`Execute response with status: ${res.status} and text: ${txtParsed}`);
221210
throw new Error(
222211
JSON.stringify({
223212
error: "UNKNOWN",
224-
error_msg: `An unknown problem occured and we got the status ${res.status} with response ${JSON.stringify(
213+
error_msg: `An unknown problem occurred and we got the status ${res.status} with response ${JSON.stringify(
225214
res,
226215
)}`,
216+
status: res.status,
227217
}),
228218
);
229219
}

0 commit comments

Comments
 (0)