Skip to content

Error handling within Hapi Sentry integration #11069

@joshkel

Description

@joshkel

Problem Statement

We're looking into switching from the third-party hapi-sentry package to Sentry's built-in Hapi support, mainly to benefit from the added tracing support. However, the built-in Hapi support has what seems to be a potentially unwanted feature: every Hapi Boom response (i.e., every HTTP 4xx or 5xx response) is captured as a Sentry exception.

Is this intended? I would expect that Sentry exceptions are for things that are very likely programming errors, not conditions like bad or unauthorized requests (HTTP 4xx) that are often outside of the application's control.

Solution Brainstorm

  1. Add an option to Integrations.Hapi to configure the error plugin and tracing plugin separately (so we could continue to use the third-party hapi-sentry).
  2. More directly expose / export hapiErrorPlugin and hapiTracingPlugin so that I can add one or the other or both to my Hapi server myself (and can then pick hapi-sentry over hapiErrorPlugin).
  3. Add an option to Integrations.Hapi to control whether the error plugin captures Boom replies as exceptions.
  4. Don't capture Boom replies by default.
  5. Some combination of the above.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions