Skip to content

mainmatter/ember-error-route

Folders and files

NameName
Last commit message
Last commit date

Latest commit

71fcdb0 · Mar 3, 2025
Feb 19, 2025
Dec 10, 2021
Dec 9, 2021
Aug 20, 2023
Aug 19, 2023
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Aug 19, 2023
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Sep 19, 2022
Dec 9, 2021
Jan 2, 2024
Oct 10, 2023
Dec 9, 2021
Dec 9, 2021
Mar 1, 2025
Mar 3, 2025
Dec 9, 2021

Repository files navigation

ember-error-route

This addon will help you build better “404 Not Found” and other error pages in Ember.js.

Take a look at our demo page to better understand what this does!

Note

ember-error-route was written and is maintained by Mainmatter and contributors. We offer consulting, training, and team augmentation for Ember.js – check out our website to learn more!

Compatibility

  • Ember.js v3.20 or above
  • Ember CLI v3.20 or above
  • Node.js v12 or above

Installation

ember install ember-error-route

Usage

  1. Add an error route (this.route('error', { path: '*path' });) to the app/router.js file

  2. Add the error route implementation:

import ErrorRoute from 'ember-error-route';

export default class CatchAllRoute extends ErrorRoute {}
  1. Wrap your model() hooks with try/catch and redirect the user to the error route:
@service router;

async model(params, transition) {
  try {
    return await fetch(`https://movies.com/${params.id}.json`);
  } catch (error) {
    this.router.replaceWith('error', { transition, error, title: 'Movie not found' });
  }
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.