# grape

Published articles for grape.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Standardizing Exception Message Style in Ruby

DevFeed: [Standardizing Exception Message Style in Ruby](<https://devfeed.tech/articles/standardizing-exception-message-style-in-ruby-20535.md>)

Original publisher: [Read original article](<https://code.dblock.org/2026/09/05/standardizing-exception-message-style-in-ruby.html>)

Author: Daniel Doubrovkine (dblock@dblock.org)

Published: 2026-09-05T00:00:00Z

Content type: article

Language: en

Sources: [Daniel Doubrovkine](<https://devfeed.tech/sources/daniel-doubrovkine.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [ci](<https://devfeed.tech/topics/ci.md>)

Tags: [ci](<https://devfeed.tech/tags/ci.md>), [exception](<https://devfeed.tech/tags/exception.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [grape](<https://devfeed.tech/tags/grape.md>), [lint](<https://devfeed.tech/tags/lint.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [plugin](<https://devfeed.tech/tags/plugin.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [standard](<https://devfeed.tech/tags/standard.md>)

### AI overview

The article explains a convention for Ruby exception messages: they should generally begin with lowercase and omit trailing punctuation because they follow the exception class name and a colon. It describes fixing seven inconsistent sites in Grape, documenting the convention, and releasing the rubocop-exception_messages RuboCop plugin to enforce casing and punctuation, with additional checks for redundant class names and interpolation markers.

### Source excerpt

While reviewing dozens of PRs from ericproulx optimizing Grape's internals recently, I noticed that the bare raise ArgumentError, "..." calls scattered across the codebase were inconsistent: some messages were capitalized, some ended in a period, most were not. Longtime readers know where this is going. Ruby's own core and standard library exceptions don't do this - TypeError: no implicit conversion from nil to integer, ArgumentError: wrong number of arguments, and so on all read lowercase and unpunctuated, because the message is meant to be read after the exception class name and a colon, not as a standalone sentence. Grape's own Grape::Exceptions::* classes already follow this convention. The bare raise ArgumentError, "..." calls in dsl/entity.rb, dsl/inside_route.rb, dsl/validations.rb, and validations/types/dry_type_coercer.rb didn't, so I fixed those seven sites and documented the convention in CONTRIBUTING.md, in #2909. To avoid regressions, I wrote rubocop-exception_messages, a RuboCop plugin gem with two cops: ExceptionMessages/Casing flags (and autocorrects) messages that don't start with a lowercase letter. ExceptionMessages/Punctuation flags (and autocorrects) messages with a trailing period, with an exception for a literal ellipsis ("still processing.."), which is stylistic rather than a sentence ending. Both cops recognize raise Class, "message" and raise Class.new("message") forms, and handle interpolated (dstr) messages by only checking the literal string segments (the first segment for casing, the last for punctuation), since interpolated values in the middle are out of the cop's control. # bad raise ArgumentError, 'Missing required option.' # good raise ArgumentError, 'missing required option' The gem ships as a modern RuboCop plugin (via lint_roller), so it's a one-line addition to a consuming project's .rubocop.yml: plugins: - rubocop-exception_messages rubocop-exception_messages 0.2.0 is out now, and I've added it back to Grape's own Gemfile and