Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
* [#3018](https://github.com/ruby-grape/grape/pull/3018): Stop copying the auth middleware per request - [@ericproulx](https://github.com/ericproulx).
* [#3023](https://github.com/ruby-grape/grape/pull/3023): Raise from `error!` instead of throwing `:error`, so a transaction it leaves rolls back - [@ericproulx](https://github.com/ericproulx).
* [#3027](https://github.com/ruby-grape/grape/pull/3027): Scrub outside input through one helper, `Grape::Util::Scrub` - [@ericproulx](https://github.com/ericproulx).
* [#3030](https://github.com/ruby-grape/grape/pull/3030): Restore the Error middleware's two defaults without restating every option - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

### 4.0.1 (2026-09-15)
Expand Down
16 changes: 6 additions & 10 deletions lib/grape/middleware/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@ def initialize(
# `Endpoint#error_middleware_options` when the API called no
# `rescue_from` and no `format` — and an explicit nil bypasses the
# keyword defaults above, so restore them here rather than letting nil
# propagate to `def_delegator :rescue_options, :backtrace` or to the
# formatter lookup in `#format_message`.
super(
rescue_options: rescue_options || Grape::DSL::RescueOptions.new,
default_error_formatter: default_error_formatter || Grape::ErrorFormatter::Txt,
all_rescue_handler:, base_only_rescue_handlers:, content_types:,
default_message:, default_status:, error_formatters:, format:,
grape_exceptions_rescue_handler:, internal_grape_exceptions_rescue_handler:,
rescue_all:, rescue_grape_exceptions:, rescue_handlers:
)
# reach `rescue_options.backtrace` in `#initialize` or the formatter
# lookup in `#format_message`. A bare `super` hands the parameters
# over as they stand, these two included.
rescue_options ||= Grape::DSL::RescueOptions.new
default_error_formatter ||= Grape::ErrorFormatter::Txt
super
end
end

Expand Down
Loading