diff --git a/app/controllers/error.js b/app/controllers/error.js
index eaac28d01f..fe1c611f84 100644
--- a/app/controllers/error.js
+++ b/app/controllers/error.js
@@ -6,4 +6,12 @@ export default class ErrorController extends Controller {
forceRefresh() {
location.reload();
}
+
+ get isA404() {
+ if (this.model?.errors.length > 0) {
+ return Number(this.model.errors[0].status) === 404;
+ }
+
+ return false;
+ }
}
diff --git a/app/styles/components.scss b/app/styles/components.scss
index c0e2dba098..214154ab3a 100644
--- a/app/styles/components.scss
+++ b/app/styles/components.scss
@@ -7,6 +7,7 @@
@import "components/course-director-manager";
@import "components/course-search-result";
@import "components/dashboard-loading";
+@import "components/error";
@import "components/filter-tools";
@import "components/flash-messages";
@import "components/global-search";
diff --git a/app/styles/components/error.scss b/app/styles/components/error.scss
new file mode 100644
index 0000000000..0be49497dc
--- /dev/null
+++ b/app/styles/components/error.scss
@@ -0,0 +1,5 @@
+@use "../ilios-common/mixins" as cm;
+
+.full-screen-error {
+ @include cm.main-section;
+}
diff --git a/app/templates/error.hbs b/app/templates/error.hbs
index 81912058de..f221a0386d 100644
--- a/app/templates/error.hbs
+++ b/app/templates/error.hbs
@@ -1,10 +1,14 @@
-
-
- {{t "general.finalErrorDisplayMessage"}}
-
-
-
-
+
+ {{#if this.isA404}}
+
+ {{else}}
+
+ {{t "general.finalErrorDisplayMessage"}}
+
+
+
+
+ {{/if}}
diff --git a/ember-cli-build.js b/ember-cli-build.js
index 5f386fb6d1..dc279c959a 100644
--- a/ember-cli-build.js
+++ b/ember-cli-build.js
@@ -74,7 +74,7 @@ module.exports = function (defaults) {
'dashboard.activities',
'dashboard.calendar',
'dashboard.materials',
- 'error',
+ // 'error', don't ever split the error route, it will break error handling
'events',
'four-oh-four',
/instructor[a-z-]*/,
diff --git a/tests/acceptance/four-oh-four-test.js b/tests/acceptance/four-oh-four-test.js
index 3331003039..e68dc3afb0 100644
--- a/tests/acceptance/four-oh-four-test.js
+++ b/tests/acceptance/four-oh-four-test.js
@@ -30,4 +30,22 @@ module('Acceptance | FourOhFour', function (hooks) {
await visit('/nothing');
assert.strictEqual(currentRouteName(), 'four-oh-four');
});
+
+ test('visiting missing course', async function (assert) {
+ await visit('/courses/1337');
+ assert
+ .dom('.full-screen-error')
+ .hasText(
+ "Rats! I couldn't find that. Please check your page address, and try again. Back to Dashboard",
+ );
+ });
+
+ test('visiting missing report #5127', async function (assert) {
+ await visit('/reports/subjects/1989');
+ assert
+ .dom('.full-screen-error')
+ .hasText(
+ "Rats! I couldn't find that. Please check your page address, and try again. Back to Dashboard",
+ );
+ });
});