forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Improve theme validation error messaging (TryGhost#7253)
refs TryGhost#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
- Loading branch information
Showing
6 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
Submodule client
updated
from a14ac5 to eb0db3
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// # 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; |
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
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