Skip to content

Commit

Permalink
JS: Always throw Error instances
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Mar 30, 2015
1 parent 7ba7c06 commit d68ccd6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/style_guides/javascript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ Follow `Felix's Node Style <https://github.com/felixge/node-style-guide>`_ and `
- Use **4 spaces** for indentation.
- Use ``self`` to save a reference to ``this``.


Errors
******

- Always throw ``Error`` instances, not strings.

.. code-block:: javascript
// Yes
throw new Error('Something went wrong');
// No
throw 'Something went wrong';
// No
throw Error('Something went wrong');
CommonJS Modules
****************

Expand Down

0 comments on commit d68ccd6

Please sign in to comment.