Skip to content

Commit

Permalink
feat: improved error message
Browse files Browse the repository at this point in the history
  • Loading branch information
c-wide committed Apr 6, 2024
1 parent cb72434 commit 985c029
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fivemanage/winston",
"description": "The official Fivemanage transport for the winston logger, for internal use only!!!",
"version": "0.1.0",
"version": "0.2.0",
"license": "GPL-3.0-or-later",
"author": "Fivemanage",
"repository": {
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export class FivemanageTransport extends Transport {
});

if (res.ok === false) {
throw new Error("Failed to upload logs to Fivemanage");
const e = await res.json();

throw new Error(
`Status code: ${res.status}; Error: ${e.message ?? "Unknown"}`,
);
}
} catch (error) {
console.error(`Failed to process log batch: ${getErrorMessage(error)}`);
console.error(`Failed to process log batch -> ${getErrorMessage(error)}`);

if (this.shouldReprocessFailedBatches) {
this.batch.concat(batch);
Expand Down

0 comments on commit 985c029

Please sign in to comment.