Skip to content

Runtime errors name their function in the message, not in a field #1663

Backlog

Description

@disruptek

A runtime error a program catches names the function in its message text and carries no position. #1662 moves compile errors to fields; this issue holds the runtime half.

What a caller gets today:

  • About 574 primitive messages start with the function's name, such as "/: division by zero" from src/arithmetic.rs. The message then reads differently for each function that raises the same error.
  • A runtime error carries no :function, :file, :line or :col. The VM records error_loc and a stack trace, and writes both into text only (VM::format_error_with_location).
  • The eval instruction (src/vm/eval.rs) turns a runtime error inside the evaluated code into {:error :eval-error :message …}, whose message holds the stack trace, the location and Runtime error:. Its other refusals start with eval:.

The target shape:

{:error :division-by-zero :message "division by zero" :function '/ :file "math.lisp" :line 16 :col 0}

What would close it:

  • The VM adds :function, :file, :line and :col to an error a primitive raises, from the call it is running.
  • No primitive message carries its function's name.
  • eval raises the evaluated code's runtime error as that error, not as an :eval-error with text.
  • A test catches a runtime error from a primitive and reads the function and the position from the fields.

Activity

  1. added
    bug
    refactoring
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrefactoring

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions