Skip to content

Add way to get module of variable from an UndefVarError #25263

@djsegal

Description

@djsegal

Repeat of Discourse Post:


From Post:

If you do:

cur_error = nothing 

try 
  foo(bar::Main.baz) = "Rambo"
catch tmp_error
  cur_error = tmp_error
end

which gives

> cur_error
UndefVarError(:baz)

> cur_error.var
:baz

The thing I'm kind of curious about is if there is a way to get the module that should have :baz in it (i.e. Main)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestGood for Hacktoberfest participantserror messagesBetter, more actionable error messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions