Wrap Rack parameter parsing errors in Grape::Exceptions::RequestError#2670
Open
ericproulx wants to merge 1 commit intomasterfrom
Open
Wrap Rack parameter parsing errors in Grape::Exceptions::RequestError#2670ericproulx wants to merge 1 commit intomasterfrom
ericproulx wants to merge 1 commit intomasterfrom
Conversation
Danger ReportNo issues found. |
fbf05cc to
abbc9b4
Compare
ioquatix
reviewed
Apr 3, 2026
ioquatix
reviewed
Apr 3, 2026
4be9fad to
198e7ae
Compare
Replace five specific exception classes (EmptyMessageBody, TooManyMultipartFiles, TooDeepParameters, ConflictingTypes, InvalidParameters) with a single Grape::Exceptions::RequestError that forwards the Rack exception message directly. On Rack 3, a single `rescue Rack::BadRequest` covers all bad-request errors via the marker module. On Rack 2, each exception class is listed explicitly in Grape::RACK_ERRORS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
198e7ae to
a815bc3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2668
Summary
Replaces five specific Rack-related exception classes with a single
Grape::Exceptions::RequestErrorthat forwards the Rack exception's own message directly, removing Grape's translated messages for these cases.Changes
New:
Grape::Exceptions::RequestErrorA lightweight wrapper that takes any exception and an optional
status:(default 400), forwarding the exception's message as-is.Removed exception classes
Grape::Exceptions::EmptyMessageBodyEOFErrorGrape::Exceptions::TooManyMultipartFilesRack::Multipart::MultipartPartLimitError/TotalPartLimitErrorGrape::Exceptions::TooDeepParametersRack::QueryParser::ParamsTooDeepErrorGrape::Exceptions::ConflictingTypesRack::Utils::ParameterTypeErrorGrape::Exceptions::InvalidParametersRack::Utils::InvalidParameterErrorGrape::RACK_ERRORSconstantCentralises the list of rescuable Rack exceptions. On Rack 3,
Rack::BadRequestis a marker module included by all bad-request exception classes — a single rescue entry covers them all. On Rack 2, each class is listed individually.Grape::RACK_ERRORSis also used inGrape::Middleware::Base#query_paramsfor consistent handling.Breaking changes
Grape::Exceptions::RequestErrorinstead.en.yml.See
UPGRADING.mdfor migration instructions.