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

ruby-grape / grape / 24755531894 / 21
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: perf/build-headers-each-header
DEFAULT BRANCH: master
Ran 22 Apr 2026 01:36AM UTC
Files 156
Run time 4s
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

22 Apr 2026 01:33AM UTC coverage: 95.641% (-0.02%) from 95.665%
24755531894.21

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 existed solely
to make `error_response` work uniformly.

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`.

Removed `Grape::Exceptions::Base#[]`. Code that read `exception[:status]`
must switch to `exception.status` — 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

1055 of 1164 branches covered (90.64%)

Branch coverage included in aggregate %.

3333 of 3424 relevant lines covered (97.34%)

1001.12 hits per line

Source Files on job run-4.0-gemfiles/rails_8_0.gemfile - 24755531894.21
  • Tree
  • List 156
  • Changed 6
  • Source Changed 6
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 24755531894
  • 68a39162 on github
  • Prev Job for on refactor/error-response-value-object (#24754841764.8)
  • Next Job for on refactor/error-response-value-object (#24755543065.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