Skip to content

Capture and annotate NoMethodError #42

Description

@schneems

Currently this code:

class Pet
  def initialize
    @name = "cinco"
  end

  def call
    puts "Come here #{@neam.upcase}"
  end
end

Pet.new.call

Gives us this error message

scratch.rb:7:in `call': undefined method `upcase' for nil:NilClass (NoMethodError)

Which gives us no context or info about the code causing this error. I would love it to instead show:

  1  class Pet
  6    def call
❯ 7      puts "Come here #{@neam.upcase}"
  8    end
  9  end

scratch.rb:7:in `call': undefined method `upcase' for nil:NilClass (NoMethodError)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions