Conditions | 3 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3 |
Changes | 0 |
1 | 1 | module Resume |
|
23 | 1 | def suppress(error_to_ignore = StandardError, default = -> {}) |
|
24 | 16 | yield |
|
25 | # NOTE: This method needs to rescue from LoadError and Gem::LoadError |
||
26 | # which don't inherit from StandardError, hence needing to rescue from |
||
27 | # the Exception class. |
||
28 | # rubocop:disable Lint/RescueException |
||
29 | rescue Exception => error |
||
30 | 8 | raise error unless error.is_a?(error_to_ignore) |
|
31 | |||
32 | 5 | default.call |
|
33 | end |
||
34 | # rubocop:enable Lint/RescueException |
||
38 |