Skip to content

Commit

Permalink
Upgrade coerce behavior when rescuing error. (#2006)
Browse files Browse the repository at this point in the history
Fix Style/RescueStandardError
  • Loading branch information
ericproulx committed Mar 6, 2020
1 parent cd81338 commit 960c7a7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,6 @@ Style/NumericPredicate:
- 'spec/**/*'
- 'lib/grape/middleware/formatter.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Exclude:
- 'lib/grape/validations/validators/coerce.rb'

# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [#2002](https://github.com/ruby-grape/grape/pull/2002): Objects allocation optimization (lazy_lookup) - [@ericproulx](https://github.com/ericproulx).

#### Fixes
* [#2006](https://github.com/ruby-grape/grape/pull/2006): Fix explicit rescue StandardError - [@ericproulx](https://github.com/ericproulx).
* [#2004](https://github.com/ruby-grape/grape/pull/2004): Rubocop fixes - [@ericproulx](https://github.com/ericproulx).
* [#1995](https://github.com/ruby-grape/grape/pull/1995): Fix: "undefined instance variables" and "method redefined" warnings - [@nbeyer](https://github.com/nbeyer).
* [#1994](https://github.com/ruby-grape/grape/pull/1993): Fix typos in README - [@bellmyer](https://github.com/bellmyer).
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/validations/validators/coerce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def coerce_value(val)
converter.call(val)

# Some custom types might fail, so it should be treated as an invalid value
rescue
rescue StandardError
Types::InvalidValue.new
end

Expand Down

0 comments on commit 960c7a7

Please sign in to comment.