schleyfox-ernie 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +3 -4
- data/elib/ernie_native.erl +11 -7
- data/ernie.gemspec +1 -1
- metadata +2 -2
data/VERSION.yml
CHANGED
data/elib/ernie_native.erl
CHANGED
@@ -12,15 +12,19 @@ process(ActionTerm, Request) ->
|
|
12
12
|
Data = bert:encode({reply, Result}),
|
13
13
|
gen_tcp:send(Sock, Data)
|
14
14
|
catch
|
15
|
-
|
16
|
-
|
17
|
-
Trace = erlang:get_stacktrace(),
|
18
|
-
BTrace = lists:map(fun(X) -> list_to_binary(io_lib:format("~p", [X])) end, Trace),
|
19
|
-
Data = term_to_binary({error, [user, 0, <<"RuntimeError">>, BError, BTrace]}),
|
20
|
-
gen_tcp:send(Sock, Data)
|
15
|
+
exit:Error -> handle_error(Sock, Error);
|
16
|
+
error:Error -> handle_error(Sock, Error)
|
21
17
|
end,
|
22
18
|
ok = gen_tcp:close(Sock),
|
23
19
|
Log = Request#request.log,
|
24
20
|
Log2 = Log#log{tdone = erlang:now()},
|
25
21
|
Request2 = Request#request{log = Log2},
|
26
|
-
ernie_access_logger:acc(Request2).
|
22
|
+
ernie_access_logger:acc(Request2).
|
23
|
+
|
24
|
+
handle_error(Sock, Error) ->
|
25
|
+
BError = list_to_binary(io_lib:format("~p", [Error])),
|
26
|
+
Trace = erlang:get_stacktrace(),
|
27
|
+
BTrace = lists:map(fun(X) -> list_to_binary(io_lib:format("~p", [X])) end, Trace),
|
28
|
+
Data = term_to_binary({error, [user, 0, <<"RuntimeError">>, BError, BTrace]}),
|
29
|
+
gen_tcp:send(Sock, Data).
|
30
|
+
|
data/ernie.gemspec
CHANGED