diff --git a/README.md b/README.md index 962287ce..3d062514 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,20 @@ When you use preload_app, your new code goes all in the master process, and is t Note that preload_app can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preload_app is all about copying the code of master into the workers. +### Error handler for low-level errors + +If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple +textual error message (see `lowlevel_error` in [this file](https://github.com/puma/puma/blob/master/lib/puma/server.rb)). +You can specify custom behavior for this scenario. For example, you can report the error to your third-party +error-tracking service (in this example, [rollbar](http://rollbar.com)): + +```ruby +lowlevel_error_handler do |e| + Rollbar.critical(e) + [500, {}, ["An error has occured, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"]] +end +``` + ### Binding TCP / Sockets In contrast to many other server configs which require multiple flags, Puma simply uses one URI parameter with the `-b` (or `--bind`) flag: