Skip to content

Commit

Permalink
feat: await for notify will turn out to be handy for edgecases such a…
Browse files Browse the repository at this point in the history
…s sigterm etc
  • Loading branch information
enricodeleo committed Jul 1, 2022
1 parent 27bb023 commit a1967d5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ export default async function (PinoAirbrakeOptions: PinoAirbrakeOptions) {
return notice;
});

airbrake.notify({
error: stack ? obj?.err : obj?.msg,
context: {
severity: pinoLevelToSentryLevel(level),
},
});
try {
await airbrake.notify({
error: stack ? obj?.err : obj?.msg,
context: {
severity: pinoLevelToSentryLevel(level),
},
});
} catch (error) {
const consoleProperty = console.error ? 'error' : 'log';
console[consoleProperty](error);
}
}
});
}

0 comments on commit a1967d5

Please sign in to comment.