Skip to content

Instantly share code, notes, and snippets.

@viruschidai
Created March 5, 2014 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viruschidai/9360639 to your computer and use it in GitHub Desktop.
Save viruschidai/9360639 to your computer and use it in GitHub Desktop.
Node.js custom error
# Base custom error class
exports.AbstractError = class AbstractError extends Error
constructor: (msg, constr) ->
Error.captureStackTrace this, constr or this
@message = msg or 'Error'
name: 'Abstract Error'
exports.InvalidDataError = class InvalidDataError extends AbstractError
name: 'Invalid Data Error'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment