Module: Rea::ErrorUtils
- Included in:
- DBLP, DBLP::Parser
- Defined in:
- lib/rea/errors.rb
Instance Method Summary collapse
- #error_message(msg, source = nil, cause = $!) ⇒ Object
- #not_found_error!(source) ⇒ Object
- #not_implemented_error!(msg) ⇒ Object
- #parse_error!(source) ⇒ Object
- #parse_format_error!(source) ⇒ Object
- #third_party_error!(source) ⇒ Object
- #unexpected_error!(source) ⇒ Object
Instance Method Details
#error_message(msg, source = nil, cause = $!) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rea/errors.rb', line 25 def (msg, source = nil, cause = $!) msg = msg.dup msg << " #{source}" if source msg << ", #{cause.}" if cause msg end |
#not_found_error!(source) ⇒ Object
42 43 44 45 |
# File 'lib/rea/errors.rb', line 42 def not_found_error!(source) msg = ("Unable to find", source) raise Rea::NotFoundError, msg end |
#not_implemented_error!(msg) ⇒ Object
52 53 54 |
# File 'lib/rea/errors.rb', line 52 def not_implemented_error!(msg) raise Rea::NotImplementedError, msg end |
#parse_error!(source) ⇒ Object
32 33 34 35 |
# File 'lib/rea/errors.rb', line 32 def parse_error!(source) msg = ("Error while parsing", source) raise Rea::ParseError, msg end |
#parse_format_error!(source) ⇒ Object
47 48 49 50 |
# File 'lib/rea/errors.rb', line 47 def parse_format_error!(source) msg = ("Unexpected parsing error (#{source})") raise Rea::ParseFormatError, msg end |
#third_party_error!(source) ⇒ Object
37 38 39 40 |
# File 'lib/rea/errors.rb', line 37 def third_party_error!(source) msg = ("Error with third party service", source) raise Rea::ThirdPartyError, msg end |
#unexpected_error!(source) ⇒ Object
56 57 58 59 |
# File 'lib/rea/errors.rb', line 56 def unexpected_error!(source) msg = ("Unexpected error (#{source})") raise Rea::SystemError, msg end |