From 06fc37fdb5154af145480154e247637bf3ed427d Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 2 Jun 2016 16:15:08 +0200 Subject: wx: Change async error handling Previously error from async functions made an exit when the next sync call checked the message queue. This have been changed to an error report instead since the errors where async there where really hard to handle. Also changed the error report format to make it easier to filter them with a custom error_handler. --- lib/wx/src/wxe_util.erl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/wx/src/wxe_util.erl') diff --git a/lib/wx/src/wxe_util.erl b/lib/wx/src/wxe_util.erl index 3eaf6aebed..bbcd9a65ea 100644 --- a/lib/wx/src/wxe_util.erl +++ b/lib/wx/src/wxe_util.erl @@ -82,9 +82,11 @@ rec(Op) -> {'_wxe_error_', Op, Error} -> [{_,MF}] = ets:lookup(wx_debug_info,Op), erlang:error({Error, MF}); - {'_wxe_error_', Old, Error} -> - [{_,MF}] = ets:lookup(wx_debug_info,Old), - erlang:exit({Error, MF}) + {'_wxe_error_', Old, Error} -> + [{_,{M,F,A}}] = ets:lookup(wx_debug_info,Old), + Msg = io_lib:format("~p in ~w:~w/~w", [Error, M, F, A]), + wxe_master ! {wxe_driver, error, Msg}, + rec(Op) end. construct(Op, Args) -> -- cgit v1.2.3