Managing Routing Issues for Nonexistent Contacts

Learn how to display an error message for nonexistent contacts when routing in Marionette.

Now that we have routing implemented, we need to manage routing issues. Notably, displaying an error message when a user loads the URL for a nonexistent contact, e.g., #contacts/999 or #contacts/foo. Right now, our app will display a blank page, which isn’t very helpful.

We’ll need a new template to display our error message. Let’s add it to index.html:

Get hands-on with 1400+ tech skills courses.