# Show Exceptions

程序抛异常时，用什么程序来处理。

它只是接口，它关心的是用什么，而不是如何处理。(因为不是它处理的！) 对内调用 Exception Wrapper 对外调用 Public Exceptions.

```ruby
# 对内
wrapper = ExceptionWrapper.new(env, exception)
```

```ruby
# 对外
config.exceptions_app || ActionDispatch::PublicExceptions.new(Rails.public_path)
response = @exceptions_app.call(env)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kelby.gitbook.io/rails-beginner-s-guide/actiondispatch_middleware/each_middleware/middleware_show_exceptions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
