This is the native constructor:
class Error {
constructor(message, options) {}
}
This is custom constructor that is compatible with serialize-error
:
class CustomError extends Error {
constructor(message) {
super(message)
}
}
This is custom constructor that is not compatible with serialize-error
:
class CustomError extends Error {
constructor(message, requiredParameter) {
super(message)
if (!requiredParameter) {
throw new Error('requiredParameter missing')
}
}
}
Two-part solution:
Error
instead, here:Line 173 in 6f6102f
errorConstructors.set('CustomError', message => new CustomError(message, {}))
Add support for something like:
addKnownErrorConstructor(CustomError, () => new CustomError('', {}))
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too