Skip to content

Commit

Permalink
Fix playground (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtereshkov committed Feb 27, 2024
1 parent 1d49e6f commit 55336c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion playground/umka.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions runtime/std.um
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ fn error*(code: int = 0, msg: str = "", sender: any = null): Err {

fn exitif*(err: Err) {
if err.code != 0 {
fprintf(stderr(), "Runtime error: %s (code %d) in %v\n", err.msg, err.code, err.sender)
fprintf(stderr(), "Stack trace:\n")
printf("Runtime error: %s (code %d) in %v\n", err.msg, err.code, err.sender)
printf("Stack trace:\n")
for _, pos in err.trace {
fprintf(stderr(), " %s: %s (%d)\n", pos.func, pos.file, pos.line)
printf(" %s: %s (%d)\n", pos.func, pos.file, pos.line)
}
exit(err.code)
}
Expand Down
6 changes: 3 additions & 3 deletions src/umka_runtime_src.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ static const char *runtimeModuleSources[] = {
"\n"
"fn exitif*(err: Err) {\n"
" if err.code != 0 {\n"
" fprintf(stderr(), \"Runtime error: %s (code %d) in %v\\n\", err.msg, err.code, err.sender)\n"
" fprintf(stderr(), \"Stack trace:\\n\")\n"
" printf(\"Runtime error: %s (code %d) in %v\\n\", err.msg, err.code, err.sender)\n"
" printf(\"Stack trace:\\n\")\n"
" for _, pos in err.trace {\n"
" fprintf(stderr(), \" %s: %s (%d)\\n\", pos.func, pos.file, pos.line)\n"
" printf(\" %s: %s (%d)\\n\", pos.func, pos.file, pos.line)\n"
" }\n"
" exit(err.code)\n"
" } \n"
Expand Down

0 comments on commit 55336c2

Please sign in to comment.