Skip to content

Commit

Permalink
show error screen on html backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmaclarty committed Feb 23, 2016
1 parent 84d1746 commit 77f5a60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lua/traceback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,16 @@ function am._traceback(msg, thread)
if type(msg) == "string" and remove_c_stack_slots then
msg = msg:gsub("\n\t%[C%]:[^\n]*", ""):gsub("\nstack traceback:$", "")
end
return msg:gsub("\t", " ")
local msg = msg:gsub("\t", " ")
if am._main_window then
pcall(function()
local win = am._main_window
local w, h = win.pixel_width, win.pixel_height
win.clear_color = vec4(0, 0, 1, 1)
win.scene = am.bind{P = math.ortho(0, w, 0, h, -1, 1)}
^ am.translate(10, h - 10)
^ am.text("ERROR:\n"..msg, vec4(1, 1, 1, 1), "left", "top")
end)
end
return msg
end
1 change: 1 addition & 0 deletions src/am_backend_emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static void main_loop() {
if (!printed_error) {
am_log0("%s", "ERROR");
printed_error = true;
am_update_windows(eng->L); // display error screen
}
return;
}
Expand Down

0 comments on commit 77f5a60

Please sign in to comment.