[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108797] [Ruby master Bug#18170] Exception#inspect should not include newlines
From:
"st0012 (Stan Lo)" <noreply@...>
Date:
2022-06-07 20:19:36 UTC
List:
ruby-core #108797
Issue #18170 has been updated by st0012 (Stan Lo).
Sorry that the `#inspect` call actually came from the `ruby/debug`'s [own patch](https://github.com/ruby/debug/blob/master/test/support/utils.rb#L78). But I still found an `exception#inspect` occurrence in `test-unit` [here](https://github.com/test-unit/test-unit/blob/e6698ddef4a08b3744f19fe1ef6cc13e704b966e/lib/test/unit/assertions.rb#L2319). It should be easily replaced with something like `"#{exception.class}: #{exception.message}"` though.
And regarding the `ruby/debug` test failures caused by the change, I'll update the test framework's patch so it won't fail for this again.
----------------------------------------
Bug #18170: Exception#inspect should not include newlines
https://bugs.ruby-lang.org/issues/18170#change-97867
* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: mame (Yusuke Endoh)
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?
```
p StandardError.new("foo\nbar")
#=>
# #<StandardError: foo
# bar>
```
I expect `#inspect` returns a one-line string. How about returning `#<StandardError: "foo\nbar">` or something?
Recently, multi-line error messages have been increasing by the introduction of did_you_mean and error_highlight. Printing an object that contains such an exception leads to a tricky output:
```
class Foo
def initialize
@exception = begin; exampl; rescue Exception; $!; end
end
def example
end
end
p Foo.new
#=>
# #<Foo:0x00007f15aeb4ba48 @exception=#<NameError: undefined local variable or method `exampl' for #<Foo:0x00007f15aeb4ba48 ...>
#
# @exception = begin; exampl; rescue Exception; $!; end
# ^^^^^^
# Did you mean? example>>
```
This issue was originally found by @ioquatix
--
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>