Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/aws-serverless/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ export function wrapHandler<TEvent, TResult>(
if (options.captureAllSettledReasons && Array.isArray(rv) && isPromiseAllSettledResult(rv)) {
const reasons = getRejectedReasons(rv);
reasons.forEach(exception => {
captureException(exception, scope => markEventUnhandled(scope));
captureException(exception, scope => markEventUnhandled(scope, 'aws-serverless.promise'));
});
}
} catch (e) {
captureException(e, scope => markEventUnhandled(scope));
captureException(e, scope => markEventUnhandled(scope, 'aws-serverless.handler'));
throw e;
} finally {
clearTimeout(timeoutWarningTimer);
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-serverless/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const headerGetter: TextMapGetter<APIGatewayProxyEventHeaders> = {
/**
* Marks an event as unhandled by adding a span processor to the passed scope.
*/
export function markEventUnhandled(scope: Scope): Scope {
export function markEventUnhandled(scope: Scope, type: string): Scope {
scope.addEventProcessor(event => {
addExceptionMechanism(event, { handled: false });
addExceptionMechanism(event, { handled: false, type });
return event;
});

Expand Down
2 changes: 1 addition & 1 deletion packages/aws-serverless/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ describe('AWSLambda', () => {
// @ts-expect-error just mocking around...
expect(evtProcessor(event).exception.values[0]?.mechanism).toEqual({
handled: false,
type: 'generic',
type: 'aws-serverless.handler',
});
}
});
Expand Down