Skip to content

Commit

Permalink
error message includes function and constructor name
Browse files Browse the repository at this point in the history
  • Loading branch information
hemmecke committed Apr 3, 2024
1 parent a85f1ca commit 4b56421
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/interp/compiler.boot
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,16 @@ try_constant_DF(mant, exp, m, e) ==
compForm1(form is [op,:argl],m,e) ==
op="error" =>
constr :=
NULL($functorForm) => nil
first($functorForm)
fun :=
$op = constr => nil
$op
#argl = 1 =>
arg := first(argl)
u := comp(arg, $String, e) =>
[[op, u.expr], m, e]
[["error3", MKQ(constr), MKQ(fun), u.expr], m, e]
SAY ['"compiling call to error ", argl]
u := outputComp(arg, e) =>
[[op, ['LIST, ['QUOTE, 'mathprint], u.expr]], m, e]
Expand Down
3 changes: 3 additions & 0 deletions src/interp/g-error.boot
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ userError x == errorSupervisor($UserError,x)

error(x) == errorSupervisor($AlgebraError,x)

error3(con, fun, mess) ==
errorSupervisor($AlgebraError, [STRCONC(fun, '" $ ", con, '": "), mess])

nice_failure_msg(val, branch, umode) ==
uname := devaluate(umode)
of1 := coerceUn2E(val, uname);
Expand Down

0 comments on commit 4b56421

Please sign in to comment.