Throw with TypeError instead of Error
See original GitHub issueSince this lib checks “types” it would make more sense to have check()
throw TypeError
instead of a generic `Error.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
TypeError - JavaScript - MDN Web Docs
A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator...
Read more >The CLI throw the typeerror instead of return the error detail
It returns a string not a dictionary probably because of the ex.response.text format. If call load again, it will work. ... response_dict =...
Read more >Getting "TypeError: Failed to fetch" when the request hasn't ...
If parsedURL is failure, then throw a TypeError. The clone() method steps are: If this is disturbed or locked, then throw a TypeError....
Read more >How to Throw Exceptions in Python - Rollbar
Python throws the TypeError exception when there are wrong data types. Similar to TypeError, there are several built-in exceptions like:.
Read more >8. Errors and Exceptions — Python 3.11.1 documentation
Exceptions come in different types, and the type is printed as part of the message: the types in the example are ZeroDivisionError ,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently it throws
VError
, which extends fromError
. You can check against that. I don’t mind inheriting from TypeError instead, but there are quite a few kinds of internal bugs that manifest as TypeError. E.g. “Cannot read property ‘foo’ of null” is a TypeError. So TypeError is not very useful to distinguish validation from internal errors.With v0.1.12, just released, you can import
VError
and check for it usinginstanceof
.