lib/sensu/daemon.rb
def unexpected_error(error)
      if @settings && @settings[:sensu][:global_error_handler]
        backtrace = error.backtrace.join("\n")
        if @logger
          @logger.warn("global catch-all error handling enabled")
          @logger.fatal("unexpected error - please address this immediately", {
            :error => error.to_s,
            :error_class => error.class,
            :backtrace => backtrace
          })
        else
          puts "global catch-all error handling enabled"
          puts "unexpected error - please address this immediately: #{error.to_s}\n#{error.class}\n#{backtrace}"
        end
      else
        raise error
      end
    end
# Handle an unexpected error. This method is used for EM global
# catch-all error handling, accepting an error object. Error
# handling is opt-in via a configuration option, e.g. `"sensu":
# {"global_error_handler": true}`. If a user does not opt-in, the
# provided error will be raised (uncaught). If a user opts-in via
# configuration, the error will be logged and ignored :itsfine:.
#
# @param error [Object]
Handle an unexpected error. This method is used for EM global
catch-all error handling, accepting an error object. Error
handling is opt-in via a configuration option, e.g.
Handle an unexpected error . This method is used for EM global catch - all error handling accepting an error object . Error handling is opt - in via a configuration option e . g .
def unexpected_error(error)
      if @settings && @settings[:sensu][:global_error_handler]
        backtrace = error.backtrace.join("\n")
        if @logger
          @logger.warn("global catch-all error handling enabled")
          @logger.fatal("unexpected error - please address this immediately", {
            :error => error.to_s,
            :error_class => error.class,
            :backtrace => backtrace
          })
        else
          puts "global catch-all error handling enabled"
          puts "unexpected error - please address this immediately: #{error.to_s}\n#{error.class}\n#{backtrace}"
        end
      else
        raise error
      end
    end
def unexpected_error ( error ) if @settings && @settings [ :sensu ] [ :global_error_handler ] backtrace = error . backtrace . join ( "\n" ) if @logger @logger . warn ( "global catch-all error handling enabled" ) @logger . fatal ( "unexpected error - please address this immediately" , { :error => error . to_s , :error_class => error . class , :backtrace => backtrace } ) else puts "global catch-all error handling enabled" puts "unexpected error - please address this immediately: #{error.to_s}\n#{error.class}\n#{backtrace}" end else raise error end end
Handle an unexpected error.
Handle an unexpected error .
error
None