mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-09 04:31:17 +03:00
02ca986ed7
refs #7204 - Adds a new ThemeValidationError class - This error has a top level message, but will also contain all the individual errors within the `errorDetails` property - Updated the API error handling to return `errorDetails` if it is present
19 lines
494 B
JavaScript
19 lines
494 B
JavaScript
// # Theme Validation Error
|
|
// Custom error class with status code and type prefilled.
|
|
|
|
function ThemeValidationError(message, details) {
|
|
this.message = message;
|
|
this.stack = new Error().stack;
|
|
this.statusCode = 422;
|
|
if (details) {
|
|
this.errorDetails = details;
|
|
}
|
|
|
|
this.errorType = this.name;
|
|
}
|
|
|
|
ThemeValidationError.prototype = Object.create(Error.prototype);
|
|
ThemeValidationError.prototype.name = 'ThemeValidationError';
|
|
|
|
module.exports = ThemeValidationError;
|