[+] Show error for assignments and grading too

This commit is contained in:
Hykilpikonna
2019-10-13 21:46:34 -04:00
parent 4e8d3aaeb9
commit aca0b5635b
+5 -17
View File
@@ -141,11 +141,7 @@ export default class App extends Vue
// Load assignments // Load assignments
this.loadAssignments(); this.loadAssignments();
} }
else else throw new Error(response.data);
{
// Show error message
this.showError(`Error: Course data failed to load.\n(${response.data})`);
}
}) })
.catch(e => this.showError(`Error: Course data failed to load.\n(${e})`)); .catch(e => this.showError(`Error: Course data failed to load.\n(${e})`));
} }
@@ -171,13 +167,9 @@ export default class App extends Vue
// Parse json and filter it // Parse json and filter it
course.assignments = JsonUtils.filterAssignments(response.data); course.assignments = JsonUtils.filterAssignments(response.data);
} }
else else throw new Error(response.data);
{
// Show error message TODO: Show it properly
alert(response.data);
}
}) })
.catch(alert); .catch(e => this.showError(`Error: Assignments data failed to load.\n(${e})`));
}); });
// Wait for assignments to be ready. // Wait for assignments to be ready.
@@ -218,13 +210,9 @@ export default class App extends Vue
// Add it to course // Add it to course
course.grading = response.data; course.grading = response.data;
} }
else else throw new Error(response.data);
{
// Show error message TODO: Show it properly
alert(response.data)
}
}) })
.catch(alert) .catch(e => this.showError(`Error: Grading data failed to load.\n(${e})`))
} }
} }