question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Throw with TypeError instead of Error

See original GitHub issue

Since this lib checks “types” it would make more sense to have check() throw TypeError instead of a generic `Error.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dsagalcommented, Apr 8, 2020

Currently it throws VError, which extends from Error. 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.

0reactions
dsagalcommented, Jul 29, 2020

With v0.1.12, just released, you can import VError and check for it using instanceof.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found