Class: Rosette::Core::ErrorReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rosette/core/error_reporters/error_reporter.rb

Overview

Error reporter interface.

Instance Method Summary collapse

Instance Method Details

#report_error(error, options = {}) ⇒ Object

Report an error.

Raises:

  • (NotImplementedError)

11
12
13
# File 'lib/rosette/core/error_reporters/error_reporter.rb', line 11

def report_error(error, options = {})
  raise NotImplementedError, 'Please use a derived class.'
end

#report_warning(error, options = {}) ⇒ Object

Report a warning.

Raises:

  • (NotImplementedError)

18
19
20
# File 'lib/rosette/core/error_reporters/error_reporter.rb', line 18

def report_warning(error, options = {})
  raise NotImplementedError, 'Please use a derived class.'
end

#with_error_reportingObject

Catch errors raised by the block and report them.


23
24
25
26
27
# File 'lib/rosette/core/error_reporters/error_reporter.rb', line 23

def with_error_reporting
  yield
rescue Exception => e
  report_error(e)
end