diff options
author | Dan Gudmundsson <[email protected]> | 2016-10-14 16:00:40 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2016-10-17 11:56:49 +0200 |
commit | e92d0d0c4b6991dc751dcc332e11c05d304175b6 (patch) | |
tree | dfc84ed6784211ce212a72d0ce98e6e4515687e5 /lib/wx/src/gen/gl.erl | |
parent | 301675fb9ab76c5003743d1eb0ecd8a265c697f9 (diff) | |
download | otp-e92d0d0c4b6991dc751dcc332e11c05d304175b6.tar.gz otp-e92d0d0c4b6991dc751dcc332e11c05d304175b6.tar.bz2 otp-e92d0d0c4b6991dc751dcc332e11c05d304175b6.zip |
wx: Improve error handling
Fix error handling in gl as in wx.
Diffstat (limited to 'lib/wx/src/gen/gl.erl')
-rw-r--r-- | lib/wx/src/gen/gl.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/wx/src/gen/gl.erl b/lib/wx/src/gen/gl.erl index e10b99b10a..3780cca651 100644 --- a/lib/wx/src/gen/gl.erl +++ b/lib/wx/src/gen/gl.erl @@ -283,7 +283,7 @@ call(Op, Args) -> Port = get(opengl_port), _ = erlang:port_control(Port,Op,Args), - rec(). + rec(Op). %% @hidden cast(Op, Args) -> @@ -292,11 +292,15 @@ cast(Op, Args) -> ok. %% @hidden -rec() -> - receive +rec(Op) -> + receive {'_egl_result_', Res} -> Res; - {'_egl_error_', Op, Res} -> error({error,Res,Op}) - end. + {'_egl_error_', Op, Res} -> error({error,Res,Op}); + {'_egl_error_', Other, Res} -> + Err = io_lib:format("~p in op: ~p", [Res, Other]), + error_logger:error_report([{gl, error}, {message, lists:flatten(Err)}]), + rec(Op) + end. %% @hidden send_bin(Bin) when is_binary(Bin) -> |