pass if occured the error is a own/subclassis instance
 @param [Class] exception_klass
519273
def RESCUE(exception_klass, &block)
      fmt_err = ->err_cls{err_cls.ancestors.take_while{|mod|mod != Object}.join(' < ')}
      block.call
    rescue exception_klass
      pass
    rescue ::Exception
      failure("Faced a exception, that kind of #{exception_klass}(#{fmt_err.call exception_klass}).",
              "Faced a exception, that instance of #{$!.class}(#{fmt_err.call $!.class}).", 2)
    else
      failure("Faced a exception, that kind of #{exception_klass}(#{fmt_err.call exception_klass}).",
              'The block was not faced any exceptions.', 2)
    ensure
      _declared!
    end
795410
def ignore_exception(exception_class):
    """"""
    def _decorator(func):
        def newfunc(*args, **kwds):
            try:
                return func(*args, **kwds)
            except exception_class:
                pass
        return newfunc
    return _decorator
889328
def set_exception(self, exc_class, exc_info, exc_stack):
        

        if self.is_finished():
            raise InternalError("set_exception called on finished AsynchronousResponse",
                                result=self._result, exception=self._exception)

        self._exception = (exc_class, exc_info, exc_stack)
        self.finish()
1281483
def catchable_exceptions(exceptions):
    
    if isinstance(exceptions, type) and issubclass(exceptions, BaseException):
        return True

    if (
        isinstance(exceptions, tuple)
        and exceptions
        and all(issubclass(it, BaseException) for it in exceptions)
    ):
        return True

    return False
908180
def exception_catcher(fn):
    
    exceptions = Queue.Queue()

    @wraps(fn)
    def wrapped(*args, **kwargs):
        try:
            ret = fn(*args, **kwargs)
        except Exception:
            exceptions.put(sys.exc_info())
            raise
        return ret

    def check():
        try:
            item = exceptions.get(block=False)
            klass, value, tb = item
            raise klass, value, tb
        except Queue.Empty:
            pass

    setattr(wrapped, 'check', check)
    return wrapped
164085
def evaluate_exceptions(exceptions, options)
      exceptions.each do |exception|
        key = if exception.is_a?(Class) && exception <= Exception
          exception.name
        elsif exception.is_a?(String)
          exception
        else
          raise ArgumentError, "#{exception} isn't an Exception"
        end

        error_handlers << [key, options[:with]]
      end
    end
782791
def error(self, instance, value, error_class=None, extra=''):
        """"""
        error_class = error_class or ValidationError
        if not isinstance(value, (list, tuple, np.ndarray)):
            super(Array, self).error(instance, value, error_class, extra)
        if isinstance(value, (list, tuple)):
            val_description = 'A {typ} of length {len}'.format(
                typ=value.__class__.__name__,
                len=len(value)
            )
        else:
            val_description = 'An array of shape {shp} and dtype {typ}'.format(
                shp=value.shape,
                typ=value.dtype
            )

        if instance is None:
            prefix = '{} property'.format(self.__class__.__name__)
        else:
            prefix = "The '{name}' property of a {cls} instance".format(
                name=self.name,
                cls=instance.__class__.__name__,
            )
        message = (
            '{prefix} must be {info}. {desc} was specified. {extra}'.format(
                prefix=prefix,
                info=self.info,
                desc=val_description,
                extra=extra,
            )
        )
        if issubclass(error_class, ValidationError):
            raise error_class(message, 'invalid', self.name, instance)
        raise error_class(message)
624426
def subclass_exception(name, parents, module, attached_to=None):
    
    class_dict = {'__module__': module}
    if attached_to is not None:
        def __reduce__(self):
            # Exceptions are special - they've got state that isn't
            # in self.__dict__. We assume it is all in self.args.
            return (unpickle_inner_exception, (attached_to, name), self.args)

        def __setstate__(self, args):
            self.args = args

        class_dict['__reduce__'] = __reduce__
        class_dict['__setstate__'] = __setstate__

    return type(name, parents, class_dict)
357088
def handle_exception(e)
      if self.class.exception_handler_method
        send(self.class.exception_handler_method, e)
      elsif self.class.exception_handler_block
        self.class.exception_handler_block.call(e, self)
      end
    end
379194
def ex(klass, response)
      klass.new("Expected response to have code 2xx, got #{response.code} instead").tap do |ex|
        ex.response = response
      end
    end
97541
def raise_if(self, exception, message, *args, **kwargs):
        
        if issubclass(exception, self.minimum_defect):
            raise exception(*args, **kwargs)
        warn(message, SyntaxWarning, *args, **kwargs)
991333
def inherit_errors(error_object)
      error_object = error_object.errors if error_object.respond_to?(:errors)

      error_object.each do |k, v|
        next if _error_ignores[k.to_sym]

        if respond_to?(k)
          errors.add(k, v)
        elsif _error_map[k.to_sym]
          errors.add(_error_map[k.to_sym], v)
        else
          errors.add(:base, error_object.full_message(k, v))
        end
      end

      false
    end
1238
def evaluate(actual_exception, expected_class, expected_message=nil)
      actual_message = actual_exception && actual_exception.message
      if actual_exception.nil?
        fail new_message.expected_to_raise(expected_class).but.raised_nothing
      elsif expected_class != actual_exception.class
        fail new_message.expected_to_raise(expected_class).not(actual_exception.class)
      elsif expected_message && !(actual_message.to_s =~ %r[#{expected_message}])
        fail expected_message(expected_message).for_message.not(actual_message)
      else
        message = new_message.raises(expected_class)
        pass(expected_message ? message.with_message(expected_message) : message)
      end
    end
1143942
def getError(code, message=nil)
      klass   = find_by_code(code)
      message = build_message(klass, code, message)
      error   = klass.new(code, message)
      error
    end
1316824
def exception(  # type: ignore
        self, msg, *args, exc_info=True, **kwargs
    ) -> Task:
        
        return self.error(msg, *args, exc_info=exc_info, **kwargs)
342124
public RetryerBuilder<V> retryIfExceptionOfType(@Nonnull Class<? extends Throwable> exceptionClass) {
        Preconditions.checkNotNull(exceptionClass, "exceptionClass may not be null");
        rejectionPredicate = Predicates.or(rejectionPredicate, new ExceptionClassPredicate<V>(exceptionClass));
        return this;
    }
1141834
def __check_classes(self):
        
        # msg took from BaseAuthentication
        msg = (
            "Sanic JWT was not initialized properly. It did not received "
            "an instance of {}"
        )
        if not issubclass(self.authentication_class, Authentication):
            raise exceptions.InitializationFailure(
                message=msg.format("Authentication")
            )

        if not issubclass(self.configuration_class, Configuration):
            raise exceptions.InitializationFailure(
                message=msg.format("Configuration")
            )

        if not issubclass(self.responses_class, Responses):
            raise exceptions.InitializationFailure(
                message=msg.format("Responses")
            )