An alternative approach would be to mark errors and store them in a WeakSet
. The benefit is that we would not have to modify errors or use PresentableError
. The downside is that consumers would need to use this package to mark or check for presentable errors. And I'm not sure it would work cross-realm.
import meow from 'meow';
import {makeErrorPresentable, isPresentableError} from 'presentable-error';
const customError = new CustomError();
makeErrorPresentable(customError);
try {
throw customError;
} catch (error) {
if (isPresentableError(error)) {
console.error(error.message);
process.exit(1);
}
throw error;
}
Thoughts?
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