mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Updated editor error handler to work better with new API error messages
no issue - pass a received API error directly through to the notifications service rather than adding an unnecessary prefix to the error message
This commit is contained in:
parent
9dc093939f
commit
fc6574f0ed
@ -36,8 +36,6 @@ PostModel.eachAttribute(function (name) {
|
||||
watchedProps.push(`post.${name}`);
|
||||
});
|
||||
|
||||
// TODO: This has to be moved to the I18n localization file.
|
||||
// This structure is supposed to be close to the i18n-localization which will be used soon.
|
||||
const messageMap = {
|
||||
errors: {
|
||||
post: {
|
||||
@ -52,7 +50,7 @@ const messageMap = {
|
||||
scheduled: 'Scheduling failed'
|
||||
},
|
||||
scheduled: {
|
||||
scheduled: 'Updated failed',
|
||||
scheduled: 'Update failed',
|
||||
draft: 'Unscheduling failed',
|
||||
published: 'Publish failed'
|
||||
}
|
||||
@ -785,7 +783,7 @@ export default Controller.extend({
|
||||
// TODO: remove this once validations are fixed
|
||||
errorMessage = error[0];
|
||||
} else if (error && error.payload && error.payload.errors && error.payload.errors[0].message) {
|
||||
errorMessage = error.payload.errors[0].message;
|
||||
return this.notifications.showAPIError(error, {key: 'post.save'});
|
||||
} else {
|
||||
errorMessage = 'Unknown Error';
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ describe('Acceptance: Editor', function () {
|
||||
expect(
|
||||
find('.gh-alert').textContent,
|
||||
'alert text after failed schedule'
|
||||
).to.match(/Saving failed: Error test/);
|
||||
).to.match(/Error test/);
|
||||
});
|
||||
|
||||
it('handles title validation errors correctly', async function () {
|
||||
|
Loading…
Reference in New Issue
Block a user