Skip to content

Error objects have no file and line in their message #5

Open

Description

@dmccuskey

Goal

Give Error objects the file and line where they were raised, as string errors have in front of their message.

Why

error( "msg" ) produces file.lua:12: msg, but an Error object's message has no place: it's only in its traceback. A printed or logged error object doesn't say where it came from.

Details

  • Listed in docs/api.md, Known Issues (0.4.0).
  • The place could be taken with debug.getinfo when the object is created (the traceback already starts there) and stored as a field, or put in front of tostring( err ). Changing the message itself would affect code that compares messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions