[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106700] [Ruby master Feature#18296] Custom exception formatting should override `Exception#full_message`.
From:
"ioquatix (Samuel Williams)" <noreply@...>
Date:
2021-12-15 20:49:55 UTC
List:
ruby-core #106700
Issue #18296 has been updated by ioquatix (Samuel Williams).
@Dan0042 I basically agree with your assessment and support (a) and in addition I'd prefer if we don't introduce inconsistent formatting for quoted messages, i.e. `#<NameError:"...">` should definitely have a space between the `:` and `"`, i.e. `#<NameError: "...">`. Otherwise it just feels like one step forward and one step backwards w.r.t. consistency.
----------------------------------------
Feature #18296: Custom exception formatting should override `Exception#full_message`.
https://bugs.ruby-lang.org/issues/18296#change-95382
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
----------------------------------------
After discussing with @eregon, we came to the conclusion that the current implementation of `did_you_mean` and `error_highlight` 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
module Formatter
def full_message(highlight:, did_you_mean: true, **options)
buffer = super(highlight: highlight, **options).dup
buffer << "extra stuff"
end
end
end
Exception.prepend DidYouMean::Formatter
module ErrorHighlight
module Formatter
def full_message(highlight:, error_highlight: true, **options)
# same as above
end
end
end
Exception.prepend ErrorHighlight::Formatter
```
--
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>