@paladen/errors
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -5,29 +5,41 @@ 'use strict'; | ||
class BaseError { | ||
constructor(props) { | ||
if (props && props.message) { | ||
this.message = props.message; | ||
} | ||
if (props && props.httpStatusCode) { | ||
this.httpStatusCode = props.httpStatusCode; | ||
} | ||
if (props && props.fields) { | ||
this.fields = props.fields; | ||
} | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
const createErrorResponseArray = (errors) => ({ | ||
errors: errors.map(err => { | ||
const obj = { | ||
name: err.name, | ||
message: err.message | ||
}; | ||
if (err.fields) { | ||
obj.fields = err.fields; | ||
} | ||
return obj; | ||
var BaseError = function BaseError(props) { | ||
_classCallCheck(this, BaseError); | ||
if (props && props.message) { | ||
this.message = props.message; | ||
} | ||
if (props && props.httpStatusCode) { | ||
this.httpStatusCode = props.httpStatusCode; | ||
} | ||
if (props && props.fields) { | ||
this.fields = props.fields; | ||
} | ||
}; | ||
var createErrorResponseArray = function createErrorResponseArray(errors) { | ||
return { | ||
errors: errors.map(function (err) { | ||
var obj = { | ||
name: err.name, | ||
message: err.message | ||
}; | ||
if (err.fields) { | ||
obj.fields = err.fields; | ||
} | ||
return obj; | ||
}) | ||
}); | ||
}; | ||
}; | ||
exports.BaseError = BaseError; | ||
exports.createErrorResponseArray = createErrorResponseArray; |
{ | ||
"name": "@paladen/errors", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"repository": "https://github.com/samstr/paladen", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "62b71aa213921f042c83d2cc33453f765fdde2fc" | ||
"gitHead": "0ed5b343b0a2a94013fcd2515ccede5bea9847a1" | ||
} |
1894
56