module Test::Unit::ErrorHandler

def add_error(exception)

def add_error(exception)
  error = Error.new(name, exception, :method_name => @method_name)
  current_result.add_error(error)
end

def handle_all_exception(exception)

def handle_all_exception(exception)
  return false if pass_through_exception?(exception)
  problem_occurred
  add_error(exception)
  true
end

def included(base)

def included(base)
  base.exception_handler(:handle_all_exception)
end

def pass_through_exception?(exception)

def pass_through_exception?(exception)
  case exception
  when *NOT_PASS_THROUGH_EXCEPTIONS
    return false
  end
  case exception.class.name
  when *NOT_PASS_THROUGH_EXCEPTION_NAMES
    return false
  end
  case exception
  when *PASS_THROUGH_EXCEPTIONS
    return true
  end
  case exception.class.name
  when *PASS_THROUGH_EXCEPTION_NAMES
    return true
  end
  false
end