Skip to content

Caught/Handled exceptions are always being logged as unhandled (@sentry/serverless) #5408

Closed
@whats-a-handle

Description

@whats-a-handle

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/serverless

SDK Version

7.6.0

Framework Version

7.6.0

Link to Sentry event

https://sentry.io/organizations/kitup-stage/issues/3418028253/events/3127d807ee0e4ba2bda444c287041aad/?project=6521764

Steps to Reproduce

  1. Create a Lambda function and wrap it with the Sentry.AWSLambda.wrapHandler()
  2. Create a try/catch block
  3. In the try block, throw an error
  4. In the catch block, call Sentry.captureException(error) to catch and log the error
  5. Expected behavior is that the handled tag is set to true because the error or exception was caught within the tr/catch and not the wrapHandler. However, the caught error is always flagged as unhandled handled:false

This might be the relevant code according to this Discord discussion in Sentry discord :

export function serverlessEventProcessor(event: Event): Event {
addExceptionMechanism(event, {
handled: false,
});
return event;
}

Expected Result

Errors caught within a try/catch block and logged in the catch statement with Sentry.captureException(error) should be marked as handled:true

Actual Result

Errors caught within the try/catch block are always marked as handled:false.
Screen Shot 2022-07-11 at 2 26 27 PM

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions