ruby-grape / ruby-grape/grape

InvalidMessageBody is no longer rescuable

Open
#2,046 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug?
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

I'm in the process of upgrading to the current version from an ancient one.

We previously used rescue_from Grape::Exceptions::InvalidMessageBody to catch unknown upload formats and document what the valid upload types are.

However, in https://github.com/ruby-grape/grape/blob/master/lib/grape/exceptions/invalid_message_body.rb a generic error is being raised instead of an InvalidMessageBody.

I don't see a straightforward hook for this; would it make sense to use InvalidMessageBody there?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/grape/exceptions/invalid_message_body.rb and trace the upload-format error path that currently raises a generic error. Confirm how rescue_from Grape::Exceptions::InvalidMessageBody is expected to handle unknown upload formats; done means those errors are rescuable through that hook, with coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.