class Rox::Core::UserspaceUnhandledErrorInvoker

Public Class Methods

new(user_unhandler_error_handler = nil) click to toggle source
# File lib/rox/core/error_handling/userspace_unhandled_error_invoker.rb, line 6
def initialize(user_unhandler_error_handler = nil)
  @user_unhandler_error_handler = user_unhandler_error_handler
end

Public Instance Methods

handler=(handler) click to toggle source
# File lib/rox/core/error_handling/userspace_unhandled_error_invoker.rb, line 24
def handler=(handler)
  @user_unhandler_error_handler = handler
end
invoke(exception_source, exception_trigger, exception) click to toggle source
# File lib/rox/core/error_handling/userspace_unhandled_error_invoker.rb, line 10
def invoke(exception_source, exception_trigger, exception)
  unless @user_unhandler_error_handler
    Logging.logger.error("User Unhandled Error Occurred, no fallback handler was set, exception ignored: #{exception}")
    return
  end

  begin
    userspace_unhandled_error_args = UserspaceUnhandledErrorArgs.new(exception_source, exception_trigger, exception)
    @user_unhandler_error_handler.call(userspace_unhandled_error_args)
  rescue StandardError => e
    Logging.logger.error("User Unhandled Error Handler itself threw an exception. original exception: #{e}")
  end
end