Skip to content

Commit 9e0a382

Browse files
author
Luca Forstner
committed
ref(serverless): Do not throw on flush error
1 parent 1badac1 commit 9e0a382

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

packages/serverless/src/awslambda.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '@sentry/node';
1212
import { extractTraceparentData } from '@sentry/tracing';
1313
import { Integration } from '@sentry/types';
14-
import { isString, logger, SentryError } from '@sentry/utils';
14+
import { isString, logger } from '@sentry/utils';
1515
// NOTE: I have no idea how to fix this right now, and don't want to waste more time, as it builds just fine — Kamil
1616
// eslint-disable-next-line import/no-unresolved
1717
import { Context, Handler } from 'aws-lambda';
@@ -318,11 +318,7 @@ export function wrapHandler<TEvent, TResult>(
318318
transaction.finish();
319319
hub.popScope();
320320
await flush(options.flushTimeout).catch(e => {
321-
if (options.ignoreSentryErrors && e instanceof SentryError) {
322-
IS_DEBUG_BUILD && logger.error(e);
323-
return;
324-
}
325-
throw e;
321+
IS_DEBUG_BUILD && logger.error(e);
326322
});
327323
}
328324
return rv;

packages/serverless/src/gcpfunction/cloud_events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ function _wrapCloudEventFunction(
6161
transaction.finish();
6262

6363
void flush(options.flushTimeout)
64-
.then(() => {
65-
callback(...args);
66-
})
6764
.then(null, e => {
6865
IS_DEBUG_BUILD && logger.error(e);
66+
})
67+
.then(() => {
68+
callback(...args);
6969
});
7070
});
7171

packages/serverless/src/gcpfunction/events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ function _wrapEventFunction(
5656
transaction.finish();
5757

5858
void flush(options.flushTimeout)
59-
.then(() => {
60-
callback(...args);
61-
})
6259
.then(null, e => {
6360
IS_DEBUG_BUILD && logger.error(e);
61+
})
62+
.then(() => {
63+
callback(...args);
6464
});
6565
});
6666

packages/serverless/src/gcpfunction/http.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ function _wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial<HttpFunctionWr
9191
transaction.finish();
9292

9393
void flush(options.flushTimeout)
94-
.then(() => {
95-
_end.call(this, chunk, encoding, cb);
96-
})
9794
.then(null, e => {
9895
IS_DEBUG_BUILD && logger.error(e);
96+
})
97+
.then(() => {
98+
_end.call(this, chunk, encoding, cb);
9999
});
100100
};
101101

0 commit comments

Comments
 (0)