mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-15 03:01:37 -05:00
Added original error message to context in "Invalid lexical structure" error
no issue - setting the original error message to the `context` property means it's not completely lost and gives us a clue for debugging - updated the lexical and mobiledoc validation errors to use the messages+tpl pattern
This commit is contained in:
parent
b2d449fecf
commit
d5f03ec0b1
1 changed files with 10 additions and 5 deletions
|
@ -26,7 +26,11 @@ const messages = {
|
|||
expectedPublishedAtInFuture: 'Date must be at least {cannotScheduleAPostBeforeInMinutes} minutes in the future.',
|
||||
untitled: '(Untitled)',
|
||||
notEnoughPermission: 'You do not have permission to perform this action',
|
||||
invalidNewsletter: 'The newsletter parameter doesn\'t match any active newsletter.'
|
||||
invalidNewsletter: 'The newsletter parameter doesn\'t match any active newsletter.',
|
||||
invalidMobiledocStructure: 'Invalid mobiledoc structure.',
|
||||
invalidMobiledocStructureHelp: 'https://ghost.org/docs/publishing/',
|
||||
invalidLexicalStructure: 'Invalid lexical structure.',
|
||||
invalidLexicalStructureHelp: 'https://ghost.org/docs/publishing/'
|
||||
};
|
||||
|
||||
const MOBILEDOC_REVISIONS_COUNT = 10;
|
||||
|
@ -625,7 +629,7 @@ Post = ghostBookshelf.Model.extend({
|
|||
this.set('html', mobiledocLib.mobiledocHtmlRenderer.render(JSON.parse(this.get('mobiledoc'))));
|
||||
} catch (err) {
|
||||
throw new errors.ValidationError({
|
||||
message: 'Invalid mobiledoc structure.',
|
||||
message: tpl(messages.invalidMobiledocStructure),
|
||||
help: 'https://ghost.org/docs/publishing/'
|
||||
});
|
||||
}
|
||||
|
@ -646,9 +650,10 @@ Post = ghostBookshelf.Model.extend({
|
|||
this.set('html', lexicalLib.lexicalHtmlRenderer.render(this.get('lexical')));
|
||||
} catch (err) {
|
||||
throw new errors.ValidationError({
|
||||
message: 'Invalid lexical structure.',
|
||||
help: 'https://ghost.org/docs/publishing/',
|
||||
property: 'lexical'
|
||||
message: tpl(messages.invalidLexicalStructure),
|
||||
context: err.message,
|
||||
property: 'lexical',
|
||||
help: tpl(messages.invalidLexicalStructureHelp)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue