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

ruby-grape / grape / 25361551546 / 4
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: perf/build-headers-each-header
DEFAULT BRANCH: master
Ran 05 May 2026 06:36AM UTC
Files 156
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 May 2026 06:33AM UTC coverage: 95.578% (-0.02%) from 95.595%
25361551546.4

Pull #2693

github

ericproulx
Introduce Grape::Exceptions::ErrorResponse value object

`Middleware::Error#error_response` previously handled three input shapes
polymorphically: a Hash from `throw :error, {...}`, a `Grape::Exceptions::Base`
subclass, and an arbitrary user-handler return. Hash-style access like
`error[:status]` only worked on exceptions because `Grape::Exceptions::Base#[]`
delegated to `__send__` — a "pretend to be a Hash" trick that propped up the
polymorphism in `error_response`.

Introduce `Grape::Exceptions::ErrorResponse`, a small value object with
`status`, `message`, `headers`, `backtrace`, and `original_exception` readers
plus a `coerce(input)` classifier that normalizes Hash, Exception, and
ErrorResponse inputs into a uniform value at the boundary. The middleware now
calls `coerce` once at entry and reads typed attributes — no more polymorphism
puzzle in the body.

Migrated the seven internal `throw :error, hash` sites to throw `ErrorResponse`
instances. User-defined `throw :error, hash` from custom middleware or
`rescue_from` blocks continues to work via `coerce`.

`Grape::Exceptions::Base#[]` is preserved (still delegates to `__send__`) and
covered by new specs. The only contract change is that the `throw :error`
payload is now an `ErrorResponse` value object instead of a `Hash` — see
UPGRADING for migration notes.

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

1054 of 1166 branches covered (90.39%)

Branch coverage included in aggregate %.

3355 of 3447 relevant lines covered (97.33%)

1011.37 hits per line

Source Files on job run-3.3-gemfiles/rack_2_2.gemfile - 25361551546.4
  • Tree
  • List 156
  • Changed 5
  • Source Changed 5
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 25361551546
  • 49556411 on github
  • Prev Job for on refactor/error-response-value-object (#25361382857.9)
  • Next Job for on refactor/error-response-value-object (#25361617949.13)
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