
Issue #21105 has been updated by ennder (Jérôme BATAILLE). Sorry to comment on a closed issue. As a complement, I find it very useful when there is multiple objects calling the same method for exemple : ``` ruby class Example def self.runnable? check_one.same_method_call? && check_two.same_method_call? end end Example.runnable? ``` ``` ruby # The position in the line helps to know which object is nil trace.rb:4:46:in `runnable?': undefined method `same_method_call?' for nil:NilClass (NoMethodError) ``` Perhaps instead of the position we could have the name of the variable on which the call was done ? ---------------------------------------- Feature #21105: Improve Ruby Stack Trace to Include Exact Error Position (Column Number) https://bugs.ruby-lang.org/issues/21105#change-112071 * Author: ennder (Jérôme BATAILLE) * Status: Closed ---------------------------------------- ## Subject Improve Ruby Stack Trace to Include Exact Error Position (Column Number) ## Description Currently, when an exception occurs in Ruby, the stack trace provides the file name and line number but does not indicate the exact position (column number) where the error occurred within the line. This lack of precision can make debugging more challenging, especially in cases where multiple method calls or expressions are present on the same line. ## Example ``` ruby class Example def self.run nil.some_method_call # Error occurs here end end Example.run ``` ## Expected Behavior The stack trace should include the column number where the error occurred, e.g.: ``` ruby trace.rb:4:10:in `run': undefined method `some_method_call' for nil:NilClass (NoMethodError) ``` ## Benefits More precise debugging. Easier identification of errors in complex one-liner expressions. Better tooling support for editors and debuggers. ## Additional Notes Would it be possible to add this enhancement in a future Ruby version? Thank you for considering this request! -- https://bugs.ruby-lang.org/