Question about errors vs exceptions #6654
Unanswered
espruino-discuss
asked this question in
Porting to new Devices
Replies: 1 comment
-
Posted at 2015-11-27 by @gfwilliams We should really move fully over to I'm afraid it's just a bit of a hangover. There are other error types though - TypeError (invalid arguments) and InternalError (stuff that went wrong in Espruino) might be the most useful. Posted at 2015-11-27 by tve Ooops, I've been going the other direction, I'm glad I asked :-) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-11-26 by tve
Sorry for the barrage of questions, I hope it's OK.
Any wisdom about jsError vs. jsException? I see a bit of a mix in the codebase for situations where, for example, a callback argument is not actually a function, or a password is required but not provided.
My intuition would be to use an error when the program code is incorrect, such as not providing required arguments and to use exceptions when a dynamic error state is encountered that may be fixed, such as trying to send on a socket and the socket got closed in the meantime.
Beta Was this translation helpful? Give feedback.
All reactions