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

ruby-grape / grape / 32583377655
97%

Build:
DEFAULT BRANCH: master
Ran 22 Aug 2026 04:00PM UTC
Jobs 32
Files 168
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

22 Aug 2026 03:59PM UTC coverage: 96.991% (-0.004%) from 96.995%
32583377655

push

github

web-flow
Answer 500 when an error response cannot be rendered (#2840)

* Answer 500 when an error response cannot be rendered

Grape::Middleware::Error#call! renders the error response from inside its own
rescue clause, so that clause never covered the rendering. An error formatter
that raised on the payload it was handed took the exception straight out
through every middleware above Grape and into the application server —
`rescue_from :all` did not help, because the failure happened after the
handler had already returned.

A rescue_from handler echoing request-derived bytes was enough to hit it:

    rescue_from(Missing) { |e| error!({ detail: e.message }, 404) }

with an invalid UTF-8 byte in the path, the JSON formatter raised
JSON::GeneratorError and the request died rather than being answered.

Guard the rendering in error_response. On failure, first retry the API's own
format with the framework's InternalServerError, whose message is a static
string and so cannot be what defeated the first attempt; if that fails too — a
formatter broken outright rather than one payload it choked on — answer
without a formatter at all. Both attempts call format_message directly instead
of re-entering error_response, so the fallback cannot recurse. This is the
shape ActionDispatch::ShowExceptions#render_exception already has in Rails,
down to the text/plain last resort.

The guard sits on the rendering rather than around run_rescue_handler on
purpose. Wrapping the handler call too would have swallowed things that must
keep propagating, the deprecation raised when a handler returns a Hash among
them.

Exceptions that no rescue_from matches still propagate unchanged; only
rendering failures are caught.

Swallowing an exception must not make it invisible. Grape put the exception on
env['grape.exception'], but that is a Grape-private key no tracker reads, so a
rendering failure that Sentry used to report as a raised exception would have
become an unremarkable 500. Publish it o... (continued)

1228 of 1318 branches covered (93.17%)

Branch coverage included in aggregate %.

23 of 23 new or added lines in 3 files covered. (100.0%)

3865 of 3933 relevant lines covered (98.27%)

27128.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/multi_xml.gemfile - 32583377655.1 22 Aug 2026 04:00PM UTC 167
46.98
GitHub Action Run
2 run-3.3-Gemfile - 32583377655.2 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
3 run-4.0-gemfiles/grape_swagger.gemfile - 32583377655.3 22 Aug 2026 04:00PM UTC 167
55.31
GitHub Action Run
4 run-3.4-gemfiles/rack_3_2.gemfile - 32583377655.4 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
5 run-3.3-gemfiles/rack_3_1.gemfile - 32583377655.5 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
6 run-3.3-gemfiles/rails_8_1.gemfile - 32583377655.6 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
7 run-4.0-gemfiles/rails_8_1.gemfile - 32583377655.7 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
8 run-4.0-gemfiles/rack_2_2.gemfile - 32583377655.8 22 Aug 2026 04:00PM UTC 167
95.69
GitHub Action Run
9 run-3.4-gemfiles/rack_3_0.gemfile - 32583377655.9 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
10 run-4.0-gemfiles/multi_xml_0_8.gemfile - 32583377655.10 22 Aug 2026 04:00PM UTC 167
47.02
GitHub Action Run
11 run-4.0-gemfiles/rack_3_1.gemfile - 32583377655.11 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
12 run-4.0-gemfiles/rails_8_0.gemfile - 32583377655.12 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
13 run-3.3-gemfiles/rack_3_0.gemfile - 32583377655.13 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
14 run-3.4-gemfiles/rails_7_2.gemfile - 32583377655.14 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
15 run-4.0-gemfiles/hashie.gemfile - 32583377655.15 22 Aug 2026 04:00PM UTC 167
62.0
GitHub Action Run
16 run-3.4-Gemfile - 32583377655.16 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
17 run-3.4-gemfiles/rails_8_1.gemfile - 32583377655.17 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
18 run-4.0-gemfiles/rails_7_2.gemfile - 32583377655.18 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
19 run-4.0-Gemfile - 32583377655.19 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
20 run-4.0-gemfiles/rack_3_2.gemfile - 32583377655.20 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
21 run-4.0-gemfiles/dry_validation.gemfile - 32583377655.21 22 Aug 2026 04:00PM UTC 167
58.0
GitHub Action Run
22 run-3.4-gemfiles/rack_2_2.gemfile - 32583377655.22 22 Aug 2026 04:00PM UTC 167
95.69
GitHub Action Run
23 run-4.0-gemfiles/multi_json_1_20.gemfile - 32583377655.23 22 Aug 2026 04:00PM UTC 167
47.59
GitHub Action Run
24 run-3.3-gemfiles/rails_8_0.gemfile - 32583377655.24 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
25 run-3.3-gemfiles/rails_7_2.gemfile - 32583377655.25 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
26 run-3.4-gemfiles/rails_8_0.gemfile - 32583377655.26 22 Aug 2026 04:00PM UTC 168
95.73
GitHub Action Run
27 run-3.4-gemfiles/rack_3_1.gemfile - 32583377655.27 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
28 run-4.0-gemfiles/rack_3_0.gemfile - 32583377655.28 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
29 run-4.0-gemfiles/grape_entity.gemfile - 32583377655.29 22 Aug 2026 04:00PM UTC 167
50.2
GitHub Action Run
30 run-4.0-gemfiles/multi_json.gemfile - 32583377655.30 22 Aug 2026 04:00PM UTC 167
47.55
GitHub Action Run
31 run-3.3-gemfiles/rack_2_2.gemfile - 32583377655.31 22 Aug 2026 04:00PM UTC 167
95.69
GitHub Action Run
32 run-3.3-gemfiles/rack_3_2.gemfile - 32583377655.32 22 Aug 2026 04:00PM UTC 167
95.73
GitHub Action Run
Source Files on build 32583377655
  • Tree
  • List 168
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #32583377655
  • d9dc86c0 on github
  • Prev Build on master (#32582889873)
  • Next Build on master (#32583646682)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc