Skip to content

Commit 1fb577c

Browse files
author
Andrea Cosentino
committed
fix: error propagation
1 parent f4aea53 commit 1fb577c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/utils/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ export const Utils = {
403403
chunks.push(chunk);
404404
});
405405

406-
req.on("error", () => {
407-
reject(new Error("Error parsing request body"));
406+
req.on("error", (err: Error) => {
407+
reject(err);
408408
});
409409

410410
req.on("end", () => {
@@ -598,7 +598,7 @@ export const Utils = {
598598
}
599599
} catch (error: any) {
600600
logger.debug("parseRequest: ERROR - ", error);
601-
throw new UniversalApiError("Error parsing request", "ERROR", fullUrl.pathname);
601+
throw new UniversalApiError(error instanceof Error ? error : new Error(String(error)), "ERROR", fullUrl.pathname);
602602
} finally {
603603
!!parserRequest && logger.debug("parseRequest: END");
604604
}

0 commit comments

Comments
 (0)