Sha256: ef7ab96222f693e9df015da33e2fe019b2150d2be2824d5889b99ced628c14c6

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

# encoding: UTF-8

module Rosette
  module Core

    # Error reporter interface.
    class ErrorReporter
      # Report an error.
      #
      # @raise [NotImplementedError]
      def report_error(error, options = {})
        raise NotImplementedError, 'Please use a derived class.'
      end

      # Report a warning.
      #
      # @raise [NotImplementedError]
      def report_warning(error, options = {})
        raise NotImplementedError, 'Please use a derived class.'
      end

      # Catch errors raised by the block and report them.
      def with_error_reporting
        yield
      rescue Exception => e
        report_error(e)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosette-core-1.0.1 lib/rosette/core/error_reporters/error_reporter.rb