Marketpath CMS Developer Tutorial Series

Error Pages

Last Updated 3/6/2018

Bad things happen on good sites. Sometimes it's not your fault, but you can still turn a bad experience into a good one with a helpful or humorous error page.

There are many kinds of errors that can occur on a site.

  • The most common error is a 404 Not Found error. This error occurs when a user attempts to access a page that does not exist. There are endless reasons why the user might have tried to access that page (typographical errors, old/outdated links, and invalid markup to name a few), but the reason often does not matter to the user when they get there. Make a helpful 404 page to get them back on the right track and they might forgive you even if it is your fault.
  • Another common error is a 401 Unauthorized error. This error occurs when a user attempts to access a "protected" page without valid credentials. Users will not see this error on Marketpath CMS sites at the moment, but the day is coming when you will be able to create protected pages that users will have to log in to access, and when that day comes having a 401 page may help to explain why they can't get where they thought they were going.
  • Less common is the 403 Forbidden error. Similar to the 401 error, this is an authorization error, but where the 401 error tells you that you have to log in, the 403 error tells you that although you are currently logged in you still have insufficient permissions to access the requested resource. A 403 error page is likely to become helpful at roughly the same time as the 401 error page.
  • The 400 Bad Request error should be less common. This is a bit of a catch-all for bad http requests. It often does not tell you exactly why your request is bad - it could be due to a large variety of reasons. A couple common examples of when a 400 error page might be shown are when you request an invalid resource from the API, or when you attempt to submit a form to an invalid URL.
  • The 500 Internal Server Error should be the least common of all - or at least we at Marketpath hope so. Nevertheless, this error may occasionally be displayed - particularly during development when the developer inadvertently attempts to do something invalid. Having a 500 error page is a friendly way of saying, "Oops. We made a mistake."
  • The 0 Catchall is simply our shortcut for creating an error page that covers any not-previously covered error codes. Instead of having to define a separate error page for each possible error code, you can create one page that may be served for any of those error types.

In addition to enabling you to create a separate error page for each error code, we also enable you to create "filters" for your error pages. For instance, if all of your blog posts use the common "/blog" URL prefix, you might create a blog-specific error page that is displayed for any URL starting with "/blog". Or, if you have multiple domains on your site, you may create a separate error page for each domain that reflects the messaging on that specific domain instead of displaying the same error page on each.

The bottom line is that you should create at least one error page early in your development process - and may want to create a series of error pages to capitalize on your users' misfortune and turn it into positive experience instead.

---- End of Lesson ----

Question? Correction?

Let's work together to make our documentation as helpful as possible.

What is your name? 
What is your email address?