From d2e8a2c02abe05214bb77496121d9a0277f3e95f Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 3 Nov 2015 13:35:54 +0100 Subject: Add error decoder --- src/error.erl | 5 +++++ src/rose.erl | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/error.erl (limited to 'src') diff --git a/src/error.erl b/src/error.erl new file mode 100644 index 0000000..7be31a2 --- /dev/null +++ b/src/error.erl @@ -0,0 +1,5 @@ +-module(error). +-export([decode/1]). + +decode(Data) -> + 'CSTA-error-definition':decode('ErrorValue', Data). diff --git a/src/rose.erl b/src/rose.erl index a98df07..9df46a7 100644 --- a/src/rose.erl +++ b/src/rose.erl @@ -46,9 +46,13 @@ dispatch({returnResult, #'ReturnResult'{invokeId = Id, result = Data}}) -> counter:set(Id), dispatch(Data); -dispatch({returnError, #'ReturnError'{invokeId = Id, errcode = Code, parameter = Par}}) -> +dispatch({returnError, #'ReturnError'{invokeId = Id, errcode = Op, parameter = Data}}) -> counter:set(Id), - io:format("Err: ~p ~p~n", [Code, Par]), + case Op of + ?ERROR -> + {ok, Error} = error:decode(Data), + io:format("Error: ~p~n", [Error]) + end, error; dispatch({reject, #'Reject'{invokeId = Id, problem = Problem}}) -> -- cgit v1.2.3