874
edits
(Copied from User:Adw/JEP-fu) |
(→Exceptions: rephrased explanation of why we never throw raw strings) |
||
| Line 129: | Line 129: | ||
= Exceptions = | = Exceptions = | ||
Never throw raw strings, because <tt>console.exception()</tt>, which is ultimately used to log any exceptions in Jetpack, can't introspect a string to get at any additional information about where the error came from. Instead, throw a <tt>new Error()</tt>, which automatically adds metadata about the state of the stack at the time the error was thrown. This allows us to provide helpful tracebacks to developers. | |||
Being friendly to developers is an important part of Jetpack. Therefore, all error messages that developers might see should be informative and punctuated full sentences. | Being friendly to developers is an important part of Jetpack. Therefore, all error messages that developers might see should be informative and punctuated full sentences. | ||
edits