Timeline for Difference between return Error and throw Error
Current License: CC BY-SA 4.0
Post Revisions
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 5, 2021 at 20:12 | history | rollback | BuZZ-dEE |
Rollback to Revision 3
|
|
| Apr 5, 2021 at 19:29 | history | edited | Flip | CC BY-SA 4.0 |
improve title
|
| Jul 7, 2019 at 22:09 | vote | accept | BuZZ-dEE | ||
| Jul 6, 2019 at 23:51 | answer | added | jfriend00 | timeline score: 77 | |
| Jul 6, 2019 at 3:46 | comment | added | Jonas Wilms |
As the author also added an unnecessary .then, he doesn't seem to be that proficient ...
|
|
| Jul 6, 2019 at 0:02 | history | edited | BuZZ-dEE | CC BY-SA 4.0 |
edited title
|
| Jul 5, 2019 at 23:51 | comment | added | Jaromanda X | perhaps the author of that code believes try/catch impacts performance "too much" for the code - see stackoverflow.com/questions/19727905/… | |
| Jul 5, 2019 at 23:48 | history | edited | BuZZ-dEE | CC BY-SA 4.0 |
edited title
|
| Jul 5, 2019 at 23:43 | comment | added | Sterling Archer |
It depends on where you want your control. throw immediately hands control back to the caller: See MDN: "and control will be passed to the first catch block in the call stack. If no catch block exists among caller functions, the program will terminate.", while if you return a new Error, you have to handle it a different way, in another location
|
|
| Jul 5, 2019 at 23:42 | comment | added | Barmar | Returning errors is a very unusual thing to do, that's not how they're intended to be used. | |
| Jul 5, 2019 at 23:39 | history | asked | BuZZ-dEE | CC BY-SA 4.0 |