DEV: Throw on non-xhr errors (#15123)

Makes it easier to debug post-stream problems when the issue isn't with the server response.
This commit is contained in:
Jarek Radosz 2021-11-29 07:36:48 +01:00 committed by GitHub
parent 5d643a498e
commit 530eb0c9bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1215,17 +1215,21 @@ export default RestModel.extend({
// Handles an error loading a topic based on a HTTP status code. Updates
// the text to the correct values.
errorLoading(result) {
errorLoading(error) {
const topic = this.topic;
this.set("loadingFilter", false);
topic.set("errorLoading", true);
const json = result.jqXHR.responseJSON;
if (!error.jqXHR) {
throw error;
}
const json = error.jqXHR.responseJSON;
if (json && json.extras && json.extras.html) {
topic.set("errorHtml", json.extras.html);
} else {
topic.set("errorMessage", I18n.t("topic.server_error.description"));
topic.set("noRetry", result.jqXHR.status === 403);
topic.set("noRetry", error.jqXHR.status === 403);
}
},