You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<masak> m: class X::Test is Exception { method message { $.x } }; die
X::Test.new
<camelia> rakudo-moar : OUTPUT«X::Test exception produced no message [...]
<masak> ^^ is a bit suboptimal
<masak> if the message method fails for whatever reason, the exception
"produced no message"
It's technically correct that X::Test produced no message. But it
would be even better if the exception that occurs inside of .message
were thrown in some fashion:
<masak> m: class X::Test is Exception { method message { $.x } };
X::Test.new.message
<camelia> rakudo-moar : OUTPUT«Method 'x' not found for invocant of
class 'X::Test' [...]
If we can use our nested exceptions mechanism here somehow, so much
the better. As long as we throw the exception from .message in one way
or another.
<masak> m: class X::Test is Exception { method message { $.x } }; die
X::Test.new
<camelia> rakudo-moar : OUTPUT«X::Test exception produced no message [...]
<masak> ^^ is a bit suboptimal
<masak> if the message method fails for whatever reason, the exception
"produced no message"
It's technically correct that X::Test produced no message. But it
would be even better if the exception that occurs inside of .message
were thrown in some fashion:
The tricky thing here is avoiding recursion when the exception thrown from .message again produces an exception that throws an exception in its method message.
Also, I'm not sure it's actually better to throw the exception, because people expect to be able to write
try something()
warn $! if $!;
# go on here
and code like this.
I'd argue that throwing an exception from inside Exception.message is a violation of our (so far partially implicit) exception API, and the compiler's response to this is actually undefined behavior. I'd be happy to document it as such.
Migrated from rt.perl.org#126717 (status was 'open')
Searchable as RT126717$
The text was updated successfully, but these errors were encountered: