reserve •CurrentError with namespace 𝕩

This commit is contained in:
dzaima 2023-05-20 14:26:25 +03:00
parent 1e22b48225
commit d6609df820
2 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,7 @@ May be removed or renamed in the future.
Get the current error message while within the catch side of `⎊`. Dynamically-scoped. Get the current error message while within the catch side of `⎊`. Dynamically-scoped.
Might return a more informative object in the future (e.g. whether the error came from an `!`, the compiler or a builtin, maybe stacktrace reading, etc; such a format is TBD). Argument must not be a namespace, as that is reserved for future changes.
## `•internal` ## `•internal`

View File

@ -704,6 +704,7 @@ B repl_c1(B t, B x) {
#if CATCH_ERRORS #if CATCH_ERRORS
B lastErrMsg; B lastErrMsg;
B currentError_c1(B t, B x) { B currentError_c1(B t, B x) {
if (isNsp(x)) thrM("•CurrentError: Namespace 𝕩 is reserved");
dec(x); dec(x);
if (q_N(lastErrMsg)) thrM("•CurrentError: Not currently within any ⎊"); if (q_N(lastErrMsg)) thrM("•CurrentError: Not currently within any ⎊");
return inc(lastErrMsg); return inc(lastErrMsg);