chasm icon indicating copy to clipboard operation
chasm copied to clipboard

Error message improvements

Open anonymous123-code opened this issue 1 year ago • 0 comments

  • changes type errors to show the type of the value provided (previosly printed the value for ValueNodes)
    • added typeName() to Node
    • errors where the content of the element is important (List of Lists, toInt, etc.) also include the content
  • Include Line- and Column information in Runtime Errors
    • For formatting, see SourceSpan.asString()
    • added a SourceSpan interface to API, renamed original SourceSpan to SourceSpanImpl

Example Error:

Built-in function "entries" can only be applied to maps but found string in line 4, column 33-44 (4:33-4:44)
org.quiltmc.chasm.lang.api.exception.EvaluationException: Built-in function "entries" can only be applied to maps but found string in line 4, column 33-44 (4:33-4:44)
${java stacktrace of evaluator}

For file:

{
    input_map: {a: "b", b: "c", c: "d", d: "e"},
    result: {
        entries_result: entries("input_map"), // error
        from_entries_result: from_entries(entries_result[entry -> entry.key != "b"])
    }
}.result

Does the easy part of #45

anonymous123-code avatar May 10 '23 18:05 anonymous123-code