-
Notifications
You must be signed in to change notification settings - Fork 3
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
Detect error code collisions #3
Comments
I'm not sure if that's useful for all use cases, but it is surely useful for many. |
Nice idea! But it assumes that you have some kind of registry for your errors and it might be inconvenient to bind it to the |
Yes... but a boolean switch on the // creating domains for error codes
erroz.domain("api");
erroz.domain("db");
// later
erroz.domain.api({
code: "not-found"
}); // ok
erroz.domain.db({
code: "not-found"
}); // ok
erroz.domain.api({
code: "not-found"
}); // throws Duplicate Error Code With ES2015 Proxies, we could even omit the first step of creating domains. This would be done implicitly by intercepting all property retrievals on |
Sounds good! I'd still add Scheduled for the next release 👍 |
But if we have domains, we don't need an |
But domains are optional right? If we only add the feature for domains its fine to kick the option. Otherwise i would add the option for "global" errors. |
Yes, domains are optional. But if you don't use domains, erroz won't check for duplicate error codes (just the current behavior) |
Easy ™️ |
Within the same application, there should not be more than one error class associated with a given error code. Erroz should detect these collisions and throw an error.
The text was updated successfully, but these errors were encountered: