workerd icon indicating copy to clipboard operation
workerd copied to clipboard

Implements the web platform standard reportError API

Open jasnell opened this issue 10 months ago • 4 comments

Refs: https://developer.mozilla.org/en-US/docs/Web/API/reportError

/cc @irvinebroque

jasnell avatar Apr 06 '24 03:04 jasnell

If I call reportError — what happens here with Tail Workers? Will the error will show up in the exceptions field or the logs field?

https://github.com/wintercg/proposal-common-minimum-api/issues/41 https://github.com/nodejs/node/issues/38947

irvinebroque avatar Apr 06 '24 19:04 irvinebroque

... what happens here with Tail Workers?

I think that still needs to be determined. The reporting is the same as the existing logUncaughtException(...) but I don't believe that ends up directly in the tail worker's exceptions field. That'll be something we want to determine, I think.

jasnell avatar Apr 06 '24 22:04 jasnell

Yeah we should figure out before merging any change, since would be weird if this ended up showing as logs. @zebp and @maxwellpeterson may know and can point to internal tail worker code

irvinebroque avatar Apr 06 '24 23:04 irvinebroque

@irvinebroque ... ok, the PR has been updated to publish the reported error to the worker tracer as an exception. Unfortunately we can't actually have a test to verify it in workerd since workerd does not initialize the worker tracer at all. Manually verified in an internal test, however, that the reported error does, in fact, show up in the worker tracer as an exception, so I think we're good on that front.

jasnell avatar Apr 08 '24 19:04 jasnell