Skip to content
Permalink
7914eee056
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
25 lines (21 sloc) 882 Bytes
/* Custom errors to throw from api modules */
'use strict'
function error(name, default_message) {
function ErrorConstructor(message) {
this.name = name
this.message = message || default_message
this.stack = (new Error()).stack
}
ErrorConstructor.prototype = Object.create(Error.prototype)
ErrorConstructor.prototype.constructor = ErrorConstructor
return ErrorConstructor
}
module.exports = {
ItemExistsError: error('ItemExistsError', 'item exists already'),
NotFoundError: error('NotFoundError', 'item not found'),
ValidationError: error('ValidationError', 'invalid data'),
ConnectionError: error('ConnectionError', 'could not connect'),
ConfirmationError: error('ConfirmationError', 'confirmation code does not match'),
AuthorizationError: error('AuthorizationError', 'unauthorized'),
GatewayError: error('GatewayError', 'received an unexpected response')
}