-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion #2
Comments
It might also be useful to mark the name of the module throwing the error, in case a consumer only wants to present errors from a specific module: try {
del(path);
} catch (error) {
if (isPresentableError(error) && error.module === 'del') {
console.error(error.message);
process.exit(1);
}
throw error;
} |
@tommy-mitchell Yes, maybe. But I think we need some more real-world experience with this before adding additional properties. For example, app code may want this too, not just modules. So a free-form |
In one of our projects we’ve got both a public message (presentable) and an optional more tech message. That we can throw. In that way we can present the presentable part to end users but still have more details for the errors that should both be presentable and handled by the dev team. The presentable message could in our case be multilingual when we want to as well. It’s a bit of different approach than have an error only thrown to be presentable. TLDR; We’ve seen the use of an error that can be both presentable and include more details for the developers. |
Came here to suggest this. Instead of a Boolean property being the convention, how about a method like In the simple case this could just |
General discussion about how this works.
Continued from sindresorhus/del-cli#34.
The text was updated successfully, but these errors were encountered: