Decoder.runWithException() throws a plain DecoderError object which is not an Error instance. This means that the error has no stack trace attached and does not play well with generic exception handling mechanisms that expect an Error instance. (In my case, the error object was logged by Sentry which failed to provide useful information like error message and stack trace.) The same issue exists with Decoder.runPromise().
I’d suggest turning DecoderError into a subclass of Error, providing it with a message, and keeping the rest of the attributes. (Maybe it would make sense to drop kind in favor of the more standard name.) This change would be backwards compatible. I’d be happy to implement the change.
Decoder.runWithException()throws a plainDecoderErrorobject which is not anErrorinstance. This means that the error has no stack trace attached and does not play well with generic exception handling mechanisms that expect anErrorinstance. (In my case, the error object was logged by Sentry which failed to provide useful information like error message and stack trace.) The same issue exists withDecoder.runPromise().I’d suggest turning
DecoderErrorinto a subclass ofError, providing it with a message, and keeping the rest of the attributes. (Maybe it would make sense to dropkindin favor of the more standardname.) This change would be backwards compatible. I’d be happy to implement the change.