diff --git a/src/index.ts b/src/index.ts index 84e9012..29a13d2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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); + } } }); }