Skip to content

Improve error messages with source location #9

@dev-dami

Description

@dev-dami

Description

Error messages should show the exact line and column where the error occurred, with a snippet of the source code.

Current Behavior

Error: undefined variable 'foo'

Expected Behavior

Error: undefined variable 'foo'
  --> main.carv:5:10
   |
 5 |     let x = foo + 1;
   |             ^^^

Where to Start

  • pkg/eval/eval.go - Errors are generated here
  • pkg/types/checker.go - Type errors
  • pkg/parser/parser.go - Parse errors
  • Token structs already have Line/Column info

Good First Issue

This improves developer experience significantly! Can be done incrementally - start with one error type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions