module Webmachine::RescuableException

Constants

UNRESCUABLE
UNRESCUABLE_DEFAULTS

Public Class Methods

===(e) click to toggle source
# File lib/webmachine/rescueable_exception.rb, line 13
def self.===(e)
  case e
  when *UNRESCUABLE then false
  else true
  end
end
UNRESCUABLEs() click to toggle source

@return [Array<Exception>]

Returns an Array of exceptions that will not be
rescued by {Webmachine::Resource#handle_exception}.
# File lib/webmachine/rescueable_exception.rb, line 36
def self.UNRESCUABLEs
  UNRESCUABLE.to_a
end
add(*exceptions) click to toggle source

Add a variable number of exceptions that should be rescued by {Webmachine::Resource#handle_exception}. See {UNRESCUABLE_DEFAULTS} for a list of exceptions that are not caught by default.

@param (see remove)

# File lib/webmachine/rescueable_exception.rb, line 47
def self.add(*exceptions)
  exceptions.each { |e| UNRESCUABLE.delete(e) }
end
default!() click to toggle source

Remove modifications to Webmachine::RescuableException. Restores default list of unrescue-able exceptions.

@return [nil]

# File lib/webmachine/rescueable_exception.rb, line 26
def self.default!
  UNRESCUABLE.replace Set.new(UNRESCUABLE_DEFAULTS.dup)
  nil
end
remove(*exceptions) click to toggle source

Remove a variable number of exceptions from being rescued by {Webmachine::Resource#handle_exception}. See {UNRESCUABLE_DEFAULTS} for a list of exceptions that are not caught by default.

@param [Exception] *exceptions

A subclass of Exception.
# File lib/webmachine/rescueable_exception.rb, line 59
def self.remove(*exceptions)
  exceptions.each { |e| UNRESCUABLE.add(e) }
end