• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 25872788683

14 May 2026 04:45PM UTC coverage: 97.041% (-0.01%) from 97.052%
25872788683

Pull #2717

github

ericproulx
Convert Grape::Exceptions::ErrorResponse to a Data value object

ErrorResponse was already structured as a value object — five readers,
kwarg-only constructor, hand-written `==`/`eql?`/`hash` — so swapping
the hand-rolled class for `Data.define` is a near-zero-risk
simplification. Twelve lines of boilerplate (the ivar-setting
constructor and the equality/hash trio) collapse into the Data
declaration itself, while the two class-level factories
(`from_exception` and `coerce`) and the custom `to_s` move into the
Data block unchanged.

Defaults stay on `#initialize` for the `Hash`-coerced branch in
`.coerce` (which slices a partial input) and for callers like
`Middleware::Error#default_rescue_handler` that build instances
without supplying `status`/`headers`.

No production behaviour change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2717: Convert Grape::Exceptions::ErrorResponse to a Data value object

1073 of 1155 branches covered (92.9%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

3453 of 3509 relevant lines covered (98.4%)

32149.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.85
/lib/grape/middleware/stack.rb


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc