Skip to content
Permalink
Browse files

Document how to see what users will see

  • Loading branch information...
paulcsmith committed Sep 19, 2019
1 parent 073c994 commit 32d9e09615ca8a2a4b438773474efee4e8885f8e
Showing with 26 additions and 2 deletions.
  1. +26 −2 src/actions/guides/http_and_routing/error_handling.cr
@@ -9,8 +9,32 @@ class Guides::HttpAndRouting::ErrorHandling < GuideAction
<<-MD
## Error Handling
When an exception is thrown in your code, you don't want your user left with
a blank page, so Lucky has a built in way of handling these errors.
Lucky comes built-in with a nice debug page when in development. In production
Lucky renders a simple HTML error page for browsers and JSON errors
for API endpoints.
## Error handling in development
When using a browser with Lucky in development mode, Lucky uses the
[ExceptionPage](https://github.com/crystal-loot/exception_page) shard to
display a helpful page with your stack trace, and exception message.
When using JSON Lucky renders JSON errors whether in development or
production.
### Seeing the error page your users will see
Sometimes in development you want to see the page your users will see instead
of the debug page.
To do so, change the the `settings.show_debug_output` option to `false`:
```crystal
# config/error_handler.cr
Lucky::ErrorHandler.configure do |settings|
settings.show_debug_output = false
end
```
## Customizing Error Handling

0 comments on commit 32d9e09

Please sign in to comment.
You can’t perform that action at this time.