-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add option to decide behavior #25
Comments
strict
option that throws on anything that is not an Error
object
// @OsoianMarcel @samchon @semmel I could use some opinions on this. |
Yes, in practice all sorts of crap is thrown. Other than non-objects, e.g. objects which contain a collection of several errors and root level My expectation from
Yes, but the values of I can imagine some mapping from non-object primitives to But what would the |
They would be useful in the sense that they would indicate that an invalid error was passed.
It would use Line 76 in 480ed36
|
Requiring the Node.js built-in Otherwise I would be polite to add a build step to generate some distribution files for the browser using a |
@semmel , you can install |
You can throw anything in JS, but it's a bad practice. I'd like to have it fail rather than silently accept anything. Though, it's not a good default, so should be opt-in.
Actually, there's 3 possible behaviors:
object
. (wanted default)I'd like
1
to be the default behavior, for consistency, but add an option to be able to opt into2
(which is the current behavior) or3
(which would be the strict behavior). This should be a single option.Another benefit of
1
is that the TypeScript types can be better. We can guarantee it's an object and we can also guarantee that thename
,message
, andstack
properties exist.The text was updated successfully, but these errors were encountered: