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

ruby-grape / grape / 25569862791
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: security/mounted-rack-auth-and-html-escape
DEFAULT BRANCH: master
Ran 08 May 2026 05:31PM UTC
Jobs 37
Files 158
Run time 1min
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

08 May 2026 05:31PM UTC coverage: 96.874% (-0.06%) from 96.935%
25569862791

Pull #2703

github

ericproulx
Catch and route exceptions raised inside rescue_from blocks

Resolves #2482. Today, an exception raised inside a `rescue_from`
block bubbles up uncaught and produces the Rack default 500 page,
which means deliberate re-raises (a common pattern for translating
one exception class into another) don't compose with the rest of a
user's `rescue_from` configuration, and accidental crashes inside a
handler are not framed as Grape responses.

The middleware now wraps the user's handler invocation with a
StandardError rescue and, on raise, routes the new exception through
one of three paths:

  1. If the re-raised exception's class has a registered `rescue_from`
     handler, run it (with `redispatched: true` so a second raise stops
     the chain — bounded at one redispatch to prevent loops).
  2. If the re-raised exception is a `Grape::Exceptions::Base` subclass,
     render it via the default Grape error path with its own `status`
     and `message`. Inheritance signals the message is part of the API
     contract.
  3. Otherwise, fall through to `safe_default`: log the original
     exception via the API's logger, expose it on
     `env['grape.exception']` for upstream Rack middleware to observe,
     and render `Grape::Exceptions::InternalServerError` (status 500,
     generic message). The original exception's message is never
     surfaced to the API consumer in this branch.

Also adds:
  - `Grape::Exceptions::InternalServerError` — i18n-backed safe stand-in.
  - `Grape::Env::GRAPE_EXCEPTION` — env key carrying the original.
  - `oneof: 'does not match...'` removed (was on a different branch).

Existing behaviour preserved when the handler returns a non-Response
non-error value (still produces `InvalidResponse` via the default
handler).

UPGRADING note + README rescue_from section updated to document the
new behaviour and the registered-handler escape hatch for users who
want raw exception messages exposed (e.g. development mode).

Co-Authored-By: Claud... (continued)
Pull Request #2703: Catch exceptions raised inside rescue_from blocks (#2482)

1090 of 1179 branches covered (92.45%)

Branch coverage included in aggregate %.

38 of 39 new or added lines in 4 files covered. (97.44%)

3 existing lines in 2 files now uncovered.

3435 of 3492 relevant lines covered (98.37%)

32029.99 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
93.24
-1.58% lib/grape/middleware/error.rb

Coverage Regressions

Lines Coverage ∆ File
2
93.24
-1.58% lib/grape/middleware/error.rb
1
93.26
0.0% lib/grape/dsl/request_response.rb
Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/multi_xml.gemfile - 25569862791.1 08 May 2026 05:31PM UTC 157
35.62
GitHub Action Run
2 run-3.2-gemfiles/rack_2_2.gemfile - 25569862791.2 08 May 2026 05:31PM UTC 157
95.56
GitHub Action Run
3 run-4.0-gemfiles/rails_7_2.gemfile - 25569862791.3 08 May 2026 05:31PM UTC 158
95.58
GitHub Action Run
4 run-3.2-gemfiles/rack_3_1.gemfile - 25569862791.4 08 May 2026 05:31PM UTC 157
95.6
GitHub Action Run
5 run-3.3-gemfiles/rack_3_1.gemfile - 25569862791.5 08 May 2026 05:32PM UTC 157
95.56
GitHub Action Run
6 run-4.0-gemfiles/rack_2_2.gemfile - 25569862791.6 08 May 2026 05:31PM UTC 157
95.54
GitHub Action Run
7 run-3.4-gemfiles/rack_3_1.gemfile - 25569862791.7 08 May 2026 05:32PM UTC 157
95.58
GitHub Action Run
8 run-3.4-gemfiles/rails_8_1.gemfile - 25569862791.8 08 May 2026 05:32PM UTC 158
95.58
GitHub Action Run
9 run-3.4-gemfiles/rails_8_0.gemfile - 25569862791.9 08 May 2026 05:32PM UTC 158
95.58
GitHub Action Run
10 run-4.0-gemfiles/rack_3_2.gemfile - 25569862791.10 08 May 2026 05:31PM UTC 157
95.58
GitHub Action Run
11 run-4.0-gemfiles/multi_json.gemfile - 25569862791.11 08 May 2026 05:31PM UTC 157
35.62
GitHub Action Run
12 run-4.0-gemfiles/rails_8_1.gemfile - 25569862791.12 08 May 2026 05:31PM UTC 158
95.58
GitHub Action Run
13 run-4.0-gemfiles/rack_3_1.gemfile - 25569862791.13 08 May 2026 05:32PM UTC 157
95.58
GitHub Action Run
14 run-3.2-Gemfile - 25569862791.14 08 May 2026 05:31PM UTC 157
95.6
GitHub Action Run
15 run-3.4-gemfiles/rack_3_0.gemfile - 25569862791.15 08 May 2026 05:32PM UTC 157
95.58
GitHub Action Run
16 run-4.0-gemfiles/hashie.gemfile - 25569862791.16 08 May 2026 05:31PM UTC 157
62.21
GitHub Action Run
17 run-3.4-gemfiles/rails_7_2.gemfile - 25569862791.17 08 May 2026 05:32PM UTC 158
95.58
GitHub Action Run
18 run-3.2-gemfiles/rails_8_0.gemfile - 25569862791.18 08 May 2026 05:31PM UTC 158
95.61
GitHub Action Run
19 run-4.0-gemfiles/dry_validation.gemfile - 25569862791.19 08 May 2026 05:31PM UTC 157
57.64
GitHub Action Run
20 run-4.0-gemfiles/rack_3_0.gemfile - 25569862791.20 08 May 2026 05:31PM UTC 157
95.58
GitHub Action Run
21 run-3.3-gemfiles/rack_3_0.gemfile - 25569862791.21 08 May 2026 05:31PM UTC 157
95.56
GitHub Action Run
22 run-3.2-gemfiles/rails_7_2.gemfile - 25569862791.22 08 May 2026 05:31PM UTC 158
95.61
GitHub Action Run
23 run-3.3-gemfiles/rails_7_2.gemfile - 25569862791.23 08 May 2026 05:32PM UTC 158
95.56
GitHub Action Run
24 run-3.2-gemfiles/rack_3_2.gemfile - 25569862791.24 08 May 2026 05:31PM UTC 157
95.6
GitHub Action Run
25 run-4.0-Gemfile - 25569862791.25 08 May 2026 05:32PM UTC 157
95.58
GitHub Action Run
26 run-3.4-gemfiles/rack_3_2.gemfile - 25569862791.26 08 May 2026 05:32PM UTC 157
95.58
GitHub Action Run
27 run-4.0-gemfiles/grape_entity.gemfile - 25569862791.27 08 May 2026 05:32PM UTC 157
49.51
GitHub Action Run
28 run-3.3-Gemfile - 25569862791.28 08 May 2026 05:32PM UTC 157
95.56
GitHub Action Run
29 run-3.3-gemfiles/rack_2_2.gemfile - 25569862791.29 08 May 2026 05:32PM UTC 157
95.52
GitHub Action Run
30 run-3.3-gemfiles/rails_8_0.gemfile - 25569862791.30 08 May 2026 05:31PM UTC 158
95.56
GitHub Action Run
31 run-3.2-gemfiles/rails_8_1.gemfile - 25569862791.31 08 May 2026 05:32PM UTC 158
95.61
GitHub Action Run
32 run-4.0-gemfiles/rails_8_0.gemfile - 25569862791.32 08 May 2026 05:31PM UTC 158
95.58
GitHub Action Run
33 run-3.4-gemfiles/rack_2_2.gemfile - 25569862791.33 08 May 2026 05:31PM UTC 157
95.54
GitHub Action Run
34 run-3.3-gemfiles/rack_3_2.gemfile - 25569862791.34 08 May 2026 05:31PM UTC 157
95.56
GitHub Action Run
35 run-3.3-gemfiles/rails_8_1.gemfile - 25569862791.35 08 May 2026 05:31PM UTC 158
95.56
GitHub Action Run
36 run-3.2-gemfiles/rack_3_0.gemfile - 25569862791.36 08 May 2026 05:32PM UTC 157
95.6
GitHub Action Run
37 run-3.4-Gemfile - 25569862791.37 08 May 2026 05:32PM UTC 157
95.58
GitHub Action Run
Source Files on build 25569862791
  • Tree
  • List 158
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #25569862791
  • Pull Request #2703
  • PR Base - master (#25564552185)
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