chasm
chasm copied to clipboard
Error message improvements
- changes type errors to show the type of the value provided (previosly printed the value for
ValueNode
s)- added
typeName()
to Node - errors where the content of the element is important (List of Lists, toInt, etc.) also include the content
- added
- Include Line- and Column information in Runtime Errors
- For formatting, see
SourceSpan.asString()
- added a
SourceSpan
interface to API, renamed originalSourceSpan
toSourceSpanImpl
- For formatting, see
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