<p>If you put a <code>500.html</code> template in your <code>craft/templates</code> folder, then that will get displayed on the front end when a exception bubbles all the way to the top.  The same will work for other HTTP status codes as well (<code>404.html</code>, <code>503.html</code>, etc.).</p>

CC BY-SA 3.0
2015-05-18T20:01:27.120Z
Subject to the [errorTemplatePrefix setting](http://buildwithcraft.com/docs/config-settings#errorTemplatePrefix)
Marion Newlevant
CC BY-SA 3.0
2018-01-04T16:45:52.160Z
Do 3XX responses throw an exception?
ponies
CC BY-SA 3.0
2015-05-18T16:49:27.557Z
2015-05-18T16:49:27.557Z
Brad Bell
<p>So I have some exceptions being caught in a plugin, and have to assume that in some cases a 500 error is going to occur at some point.</p>

<p>How can we set up Craft so that a server error displays a template rather than the default message display (assuming devMode is OFF)?</p>

<p>This would be something we'd want working across the whole site, not just on one plugin.</p>

<plugin-development><templating><error>
How can I handle exceptions on the front end
# How can I handle exceptions on the front end

(Asked by: username_0 on 2015-05-18)

So I have some exceptions being caught in a plugin, and have to assume that in some cases a 500 error is going to occur at some point.

How can we set up Craft so that a server error displays a template rather than the default message display (assuming devMode is OFF)?

This would be something we'd want working across the whole site, not just on one plugin.

**Tags:** plugin-development, templating, error


---

## 1 answers

### Answer by username_1 on 2015-05-18. Score: 2 | Accepted answer

If you put a `500.html` template in your `craft/templates` folder, then that will get displayed on the front end when a exception bubbles all the way to the top. The same will work for other HTTP status codes as well (`404.html`, `503.html`, etc.).

> **Comments:**
> **username_2**: Subject to the [errorTemplatePrefix setting](http://buildwithcraft.com/docs/config-settings#errorTemplatePrefix)  
> **username_3**: Do 3XX responses throw an exception?  

---

