1
0
mirror of https://github.com/flarum/core.git synced 2025-07-25 02:31:17 +02:00

Improve error handling somewhat

- Fix composer crashing/not showing alert on error
- Make a general ValidationException which takes an array of field ⇒
messages to be outputted nicely by the API
This commit is contained in:
Toby Zerner
2015-08-04 13:03:46 +09:30
parent a14be00041
commit 5b3484d3c8
5 changed files with 34 additions and 6 deletions

View File

@@ -108,7 +108,11 @@ export default class DiscussionComposer extends ComposerBody {
app.cache.discussionList.addDiscussion(discussion);
m.route(app.route.discussion(discussion));
},
() => this.loading = false
response => {
this.loading = false;
m.redraw();
app.alertErrors(response.errors);
}
);
}
}

View File

@@ -92,10 +92,10 @@ export default class ReplyComposer extends ComposerBody {
app.composer.hide();
},
errors => {
response => {
this.loading = false;
m.redraw();
app.alertErrors(errors);
app.alertErrors(response.errors);
}
);
}