Project

General

Profile

Actions

Feature #19620

open

allow non-module rescue filters that implement the === opertor

Feature #19620: allow non-module rescue filters that implement the === opertor

Added by bughit (bug hit) over 2 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:113363]

Description

module FooErrorFilter def self.===(e) e.message =~ /foo/ end end def foo_error_filter FooErrorFilter end begin raise 'foo error' rescue foo_error_filter => e p e.message end 

Filter matching is done via the === operator, which is why the rescue filter modules don't need to be exception classes. But they are required to be modules, why? Since the rescue filter object is only used for the === operator it should accept any object supporting it. The module restriction seems arbitrary and pointless.

begin raise 'foo error' rescue ->e{e.message =~ /foo/} p e.message end 

Related issues 1 (0 open1 closed)

Updated by byroot (Jean Boussier) over 2 years ago Actions #1

  • Related to Bug #4438: rescue args type check omitted added
Actions

Also available in: PDF Atom