[#106341] [Ruby master Bug#18369] users.detect(:name, "Dorian") as shorthand for users.detect { |user| user.name == "Dorian" } — dorianmariefr <noreply@...>
Issue #18369 has been reported by dorianmariefr (Dorian Mari辿).
14 messages
2021/11/30
[#106351] [Ruby master Bug#18371] Release branches (release information in general) — "tenderlovemaking (Aaron Patterson)" <noreply@...>
Issue #18371 has been reported by tenderlovemaking (Aaron Patterson).
7 messages
2021/11/30
[ruby-core:106021] [Ruby master Bug#18296] Custom exception formatting should override `Exception#full_message`.
From:
"mame (Yusuke Endoh)" <noreply@...>
Date:
2021-11-11 05:49:55 UTC
List:
ruby-core #106021
Issue #18296 has been updated by mame (Yusuke Endoh).
TBH I'm unsure if I could understand what you propose. It would be very helpful if you could create a proof-of-concept patch.
I have one concern. My minimum expectation of error_highlight and did_you_mean is that the ruby interpreter should print their hints by default. However, at the present time, the ruby interpreter uses `#message` instead of `#full_message` to show the error information of uncaught exception.
```
$ ruby -e 'class Foo < Exception; def message = "message"; def full_message = "full_message"; end; raise Foo.new'
-e:1:in `<main>': message (Foo)
```
Does this proposal include that the ruby interpreter should use `#full_message` to show the error information? This is an incompatibility, is it acceptable?
There is an ecosystem to handle uncaught exception, including application monitoring services (Newrelic, DataDog, ScoutAPM, ...) and Rails' exception handling system for development mode. They also should change their code base to use `#full_message` (or more dedicated display depending on their context). I think we need to coordinate them if we introduce this incompatibility. cc @ivoanjo
----------------------------------------
Bug #18296: Custom exception formatting should override `Exception#full_message`.
https://bugs.ruby-lang.org/issues/18296#change-94607
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
After discussing with @eregon, we came to the conclusion that the current implementation of `did_you_mean` and `error_highlighter` could avoid many issues by using `Exception#full_message`.
We propose to introduce a more nuanced interface:
```ruby
class Exception
def full_message(highlight: bool, order: [:top or :bottom], **options)
# ...
end
end
module DidYouMean
class Formatter
def full_message(highlight:, did_you_mean: true, **options)
buffer = super(highlight: highlight, **options).dup
buffer << "extra stuff"
end
end
end
module ErrorHighlight
class Formatter
def full_message(highlight:, error_highlight: true, **options)
# same as above
end
end
end
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>