Created
December 5, 2016 10:21
-
-
Save stuf/864aa9a8bee695907e71ce4e402e5a86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} name | |
* @param {string} defaultMessage | |
* @returns {Function} | |
* @private | |
*/ | |
function createError(name, defaultMessage) { | |
function NewError(message) { | |
this.name = name; | |
this.message = message || defaultMessage; | |
this.stack = (new Error()).stack; | |
} | |
NewError.prototype = Object.create(Error.prototype); | |
NewError.prototype.constructor = NewError; | |
return NewError; | |
} | |
var errors = module.exports = { | |
FileSystemError: createError('FileSystemError', 'error in FileSystem call') | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment