Skip to content

Commit 960c7a7

Browse files
authored
Upgrade coerce behavior when rescuing error. (#2006)
Fix Style/RescueStandardError
1 parent cd81338 commit 960c7a7

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,6 @@ Style/NumericPredicate:
188188
- 'spec/**/*'
189189
- 'lib/grape/middleware/formatter.rb'
190190

191-
# Offense count: 1
192-
# Cop supports --auto-correct.
193-
# Configuration parameters: EnforcedStyle.
194-
# SupportedStyles: implicit, explicit
195-
Style/RescueStandardError:
196-
Exclude:
197-
- 'lib/grape/validations/validators/coerce.rb'
198-
199191
# Offense count: 11
200192
# Cop supports --auto-correct.
201193
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [#2002](https://github.com/ruby-grape/grape/pull/2002): Objects allocation optimization (lazy_lookup) - [@ericproulx](https://github.com/ericproulx).
99

1010
#### Fixes
11+
* [#2006](https://github.com/ruby-grape/grape/pull/2006): Fix explicit rescue StandardError - [@ericproulx](https://github.com/ericproulx).
1112
* [#2004](https://github.com/ruby-grape/grape/pull/2004): Rubocop fixes - [@ericproulx](https://github.com/ericproulx).
1213
* [#1995](https://github.com/ruby-grape/grape/pull/1995): Fix: "undefined instance variables" and "method redefined" warnings - [@nbeyer](https://github.com/nbeyer).
1314
* [#1994](https://github.com/ruby-grape/grape/pull/1993): Fix typos in README - [@bellmyer](https://github.com/bellmyer).

lib/grape/validations/validators/coerce.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def coerce_value(val)
7676
converter.call(val)
7777

7878
# Some custom types might fail, so it should be treated as an invalid value
79-
rescue
79+
rescue StandardError
8080
Types::InvalidValue.new
8181
end
8282

0 commit comments

Comments
 (0)