ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:110683] [Ruby master Feature#19117] Include the method owner in backtraces, not just the method name
@ 2022-11-10 12:13 byroot (Jean Boussier)
  2022-11-10 12:28 ` [ruby-core:110685] " zverok (Victor Shepelev)
                   ` (51 more replies)
  0 siblings, 52 replies; 53+ messages in thread
From: byroot (Jean Boussier) @ 2022-11-10 12:13 UTC (permalink / raw)
  To: ruby-core

Issue #19117 has been reported by byroot (Jean Boussier).

----------------------------------------
Feature #19117: Include the method owner in backtraces, not just the method name
https://bugs.ruby-lang.org/issues/19117

* Author: byroot (Jean Boussier)
* Status: Open
* Priority: Normal
----------------------------------------
```
module Foo
  class Bar
    def inspect
      1 + '1'
    end
  end
end

p Foo::Bar.new
```

This code produce the following backtrace:


```
/tmp/foo.rb:4:in `+': String can't be coerced into Integer (TypeError)
	from /tmp/foo.rb:4:in `inspect'
	from /tmp/foo.rb:9:in `p'
	from /tmp/foo.rb:9:in `<main>'
```

This works, but on large codebases and large backtraces the method name isn't always all that revealing, most of the time you need to open many of the locations listed in the backtrace to really understand what is going on.

I propose that we also include the owner name:

```
/tmp/foo.rb:4:in `Integer#+': String can't be coerced into Integer (TypeError)
	from /tmp/foo.rb:4:in `Foo::Bar#inspect'
	from /tmp/foo.rb:9:in `Kernel#p'
	from /tmp/foo.rb:9:in `<main>'
```

I believe that in many case it would allow to much better understand the backtrace without having to jump back and forth between it and the source code.

This is inspired by @ivoanjo 's `backtracie` gem: https://github.com/ivoanjo/backtracie



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2024-03-21 20:08 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 12:13 [ruby-core:110683] [Ruby master Feature#19117] Include the method owner in backtraces, not just the method name byroot (Jean Boussier)
2022-11-10 12:28 ` [ruby-core:110685] " zverok (Victor Shepelev)
2022-11-10 13:08 ` [ruby-core:110686] " Eregon (Benoit Daloze)
2022-11-10 13:11 ` [ruby-core:110687] " Eregon (Benoit Daloze)
2022-11-10 13:29 ` [ruby-core:110688] " byroot (Jean Boussier)
2022-11-10 13:50 ` [ruby-core:110691] " kjtsanaktsidis (KJ Tsanaktsidis)
2022-11-10 16:41 ` [ruby-core:110696] " Eregon (Benoit Daloze)
2022-11-11  0:23 ` [ruby-core:110701] " byroot (Jean Boussier)
2022-11-11 10:01 ` [ruby-core:110702] " Eregon (Benoit Daloze)
2022-11-11 23:37 ` [ruby-core:110712] " byroot (Jean Boussier)
2022-11-12  2:08 ` [ruby-core:110717] " kjtsanaktsidis (KJ Tsanaktsidis)
2022-11-12  2:24 ` [ruby-core:110719] " kjtsanaktsidis (KJ Tsanaktsidis)
2022-11-12  3:30 ` [ruby-core:110720] " byroot (Jean Boussier)
2022-11-12 12:24 ` [ruby-core:110724] " Eregon (Benoit Daloze)
2022-11-14  8:03 ` [ruby-core:110745] " mame (Yusuke Endoh)
2022-11-16 16:20 ` [ruby-core:110778] " ivoanjo (Ivo Anjo)
2022-11-16 16:25 ` [ruby-core:110779] " Dan0042 (Daniel DeLorme)
2022-11-16 16:40 ` [ruby-core:110780] " byroot (Jean Boussier)
2022-11-16 16:57 ` [ruby-core:110782] " Eregon (Benoit Daloze)
2022-11-16 17:01 ` [ruby-core:110783] " Eregon (Benoit Daloze)
2022-11-16 18:32 ` [ruby-core:110784] " Dan0042 (Daniel DeLorme)
2022-12-02  2:33 ` [ruby-core:111140] " mame (Yusuke Endoh)
2023-11-30  7:01 ` [ruby-core:115539] " mame (Yusuke Endoh) via ruby-core
2023-11-30  7:27 ` [ruby-core:115541] " byroot (Jean Boussier) via ruby-core
2023-11-30 12:32 ` [ruby-core:115546] " Eregon (Benoit Daloze) via ruby-core
2024-01-19  5:39 ` [ruby-core:116312] " mame (Yusuke Endoh) via ruby-core
2024-01-19  9:11 ` [ruby-core:116320] " byroot (Jean Boussier) via ruby-core
2024-01-19  9:37 ` [ruby-core:116321] " byroot (Jean Boussier) via ruby-core
2024-01-19 15:02 ` [ruby-core:116334] " Dan0042 (Daniel DeLorme) via ruby-core
2024-01-19 15:25 ` [ruby-core:116335] " byroot (Jean Boussier) via ruby-core
2024-01-19 15:36 ` [ruby-core:116337] " Dan0042 (Daniel DeLorme) via ruby-core
2024-01-19 15:42 ` [ruby-core:116338] " byroot (Jean Boussier) via ruby-core
2024-01-19 19:38 ` [ruby-core:116339] " Dan0042 (Daniel DeLorme) via ruby-core
2024-01-19 19:48 ` [ruby-core:116340] " byroot (Jean Boussier) via ruby-core
2024-01-20  0:58 ` [ruby-core:116343] " mame (Yusuke Endoh) via ruby-core
2024-01-20 11:04 ` [ruby-core:116346] " byroot (Jean Boussier) via ruby-core
2024-01-20 16:50 ` [ruby-core:116348] " Dan0042 (Daniel DeLorme) via ruby-core
2024-02-13  9:42 ` [ruby-core:116693] " ko1 (Koichi Sasada) via ruby-core
2024-02-13 10:28 ` [ruby-core:116694] " byroot (Jean Boussier) via ruby-core
2024-02-13 10:58 ` [ruby-core:116695] " Eregon (Benoit Daloze) via ruby-core
2024-02-13 18:02 ` [ruby-core:116705] " ko1 (Koichi Sasada) via ruby-core
2024-02-13 18:14 ` [ruby-core:116706] " Eregon (Benoit Daloze) via ruby-core
2024-02-14  5:10 ` [ruby-core:116729] " matz (Yukihiro Matsumoto) via ruby-core
2024-02-16  8:39 ` [ruby-core:116793] " byroot (Jean Boussier) via ruby-core
2024-02-16 11:34 ` [ruby-core:116796] " mame (Yusuke Endoh) via ruby-core
2024-02-16 11:38 ` [ruby-core:116797] " byroot (Jean Boussier) via ruby-core
2024-02-16 20:31 ` [ruby-core:116807] " Eregon (Benoit Daloze) via ruby-core
2024-02-16 21:45 ` [ruby-core:116809] " Dan0042 (Daniel DeLorme) via ruby-core
2024-02-17  3:50 ` [ruby-core:116812] " mame (Yusuke Endoh) via ruby-core
2024-02-17 10:33 ` [ruby-core:116818] " Eregon (Benoit Daloze) via ruby-core
2024-02-17 10:48 ` [ruby-core:116821] " Eregon (Benoit Daloze) via ruby-core
2024-03-21 20:08 ` [ruby-core:117285] " Eregon (Benoit Daloze) via ruby-core
2024-03-21 20:08 ` [ruby-core:117286] " Eregon (Benoit Daloze) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).