Project

General

Profile

Actions

Feature #8841

closed

Add ability to hook into WException creation/destruction

Added by Roel Standaert almost 3 years ago. Updated about 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/23/2021
Due date:
% Done:

0%

Estimated time:

Description

There are many implementations for generating stack traces. Currently Wt supports libunwind, adding the stack trace to what(), but there are many others.

When using services like Sentry it would be nice to use Sentry's own stack trace functionality, so it can be attached to the event sent to Sentry when the exception is caught.

To do this, we could add the ability for developers using Wt to globally register a hook that gets triggered upon creation (and maybe also deletion) of a WException.

How the user would then attach their own stack trace information is still an open question. We could:

  • Allow attaching arbitrary data to the WException using std::any (with the caveat that copying an object into std::any should be noexcept, since we should not have the constructor or destructor of an exception throw). We could also use void *, but this may be more difficult to use correctly.
  • Just let the developer keep their own (thread safe) data structure that maps WException pointers to extra associated data.
  • Let the developer change the message.

There's also the caveat that if WException is derived from, that type information is not available in the constructor or destructor of WException. We currently have a few exception types that derive from WException. We could just leave this as a caveat?

We can do something similar with Wt::Dbo::Exception.

Actions #1

Updated by Roel Standaert almost 3 years ago

  • Description updated (diff)
Actions #2

Updated by Roel Standaert over 2 years ago

  • Target version deleted (future)

We found a better way to do this, by hooking into __cxa_throw, so we may not put this in Wt after all.

Actions #3

Updated by Roel Standaert about 2 years ago

  • Status changed from New to Rejected

Setting this to rejected. We're no longer considering this for inclusion in Wt since there are methods like overriding __cxa_throw that work better for all exceptions.

Actions

Also available in: Atom PDF