Browse Source

no err list duplicate

221V 3 years ago
parent
commit
7dd8628e67

+ 1 - 1
src/handlers/n4u_pickle.erl

@@ -14,7 +14,7 @@ depickle(Serialized_Data) ->
     {Data, _PickleTime} = erlang:binary_to_term(base64:decode(nitro:to_binary(Serialized_Data))),
     Data
   catch _E:_R ->
-    %wf:info(?MODULE, "Depicke Error: ~p ~p", [_E, _R]),
+    %wf:info(?MODULE, "Depicke Error: ~p ~p~n", [_E, _R]),
     undefined
   end.
 

+ 1 - 1
src/handlers/n4u_secret.erl

@@ -32,7 +32,7 @@ depickle(PickledData) ->
     %Data
     erlang:binary_to_term(crypto:crypto_one_time(aes_128_cbc, Key, IV, Cipher, false), [safe]) % decrypt
   catch _E:_R ->
-    %wf:info(?MODULE, "Depicke Error: ~p ~p", [_E, _R]),
+    %wf:info(?MODULE, "Depicke Error: ~p ~p~n", [_E, _R]),
     <<"">>
   end.
 

+ 9 - 4
src/protocols/n4u_client.erl

@@ -3,25 +3,30 @@
 
 -export([info/3]).
 
+
 info({client, Message}, Req, State) ->
   wf:info(?MODULE, "Client Message: ~p", [Message]),
   Module = State#cx.module,
   Reply = try Module:event({client, Message})
   catch E:R:Stk ->
-    wf:error(?MODULE, "Catch: ~p:~p~n~p", [E, R, Stk]),
-    [E, R, Stk]
+    Err = [E, R, Stk],
+    wf:error(?MODULE, "Catch: ~p:~p~n~p", Err),
+    Err
   end,
   {reply, wf:format({io, n4u_nitrogen:render_actions(erlang:get(actions)), Reply}), Req, State};
 
+
 info({server, Message}, Req, State) ->
   wf:info(?MODULE, "Server Message: ~p", [Message]),
   Module = State#cx.module,
   Reply = try Module:event({server, Message})
   catch E:R:Stk ->
-    wf:error(?MODULE, "Catch: ~p:~p~n~p", [E, R, Stk]),
-    [E, R, Stk]
+    Err = [E, R, Stk],
+    wf:error(?MODULE, "Catch: ~p:~p~n~p", Err),
+    Err
   end,
   {reply, wf:format({io, n4u_nitrogen:render_actions(erlang:get(actions)), Reply}), Req, State};
 
+
 info(Message, Req, State) -> {unknown, Message, Req, State}.
 

+ 5 - 2
src/protocols/n4u_file.erl

@@ -23,12 +23,14 @@ info(#ftp{status = {event, _}} = FTP, Req, State) ->
   Module = State#cx.module,
   Reply = try Module:event(FTP)
   catch E:R:Stk ->
-    wf:error(?MODULE, "Catch: ~p:~p~n~p", [E, R, Stk]),
-    [E, R, Stk]
+    Err = [E, R, Stk],
+    wf:error(?MODULE, "Catch: ~p:~p~n~p", Err),
+    Err
   end,
   {reply, wf:format({io, n4u_nitrogen:render_actions(erlang:get(actions)), Reply}), Req, State};
 
 
+
 info(#ftp{id = Link, sid = _Sid, filename = _FileName, status = <<"init">>,
           block = Block, offset = Offset, 'size' = _TotalSize} = FTP, Req, State) ->
   Root = ?ROOT,
@@ -60,6 +62,7 @@ info(#ftp{id = Link, sid = _Sid, filename = _FileName, status = <<"init">>,
   {reply, wf:format(FTP2), Req, State};
 
 
+
 info(#ftp{id = Link, sid = _Sid, filename = _FileName, status = <<"send">>} = FTP, Req, State) ->
   wf:info(?MODULE, "Info Send: ~p", [FTP#ftp{data = <<>>}]),
   

+ 3 - 2
src/protocols/n4u_http.erl

@@ -12,8 +12,9 @@ info(#http{} = Message, Req, State) ->
   Module = State#cx.module,
   Reply = try Module:event(Message)
   catch E:R:Stk ->
-    wf:error(?MODULE, "Catch: ~p:~p~n~p", [E, R, Stk]),
-    [E, R, Stk]
+  	Err = [E, R, Stk],
+    wf:error(?MODULE, "Catch: ~p:~p~n~p", Err),
+    Err
   end,
   {reply, wf:format({io, n4u_nitrogen:render_actions(erlang:get(actions)), Reply}), Req, State};
 

+ 12 - 8
src/protocols/n4u_nitrogen.erl

@@ -16,8 +16,9 @@ info({init, Rest}, Req, State) ->
         nitro:render(Elements),
         {ok, []}
       catch E1:R1:Stk1 ->
-        wf:error(?MODULE, "main: E:R:Stk: ~p ~p~n ~p~n", [E1, R1, Stk1]),
-        {error, [E1, R1, Stk1]}
+        Err1 = [E1, R1, Stk1],
+        wf:error(?MODULE, "main: E:R:Stk: ~p ~p~n ~p~n", Err1),
+        {error, Err1}
       end;
     
     Binary ->
@@ -34,8 +35,9 @@ info({init, Rest}, Req, State) ->
           _ -> n4u_session:ensure_sid([], ?CTX, [])
         end
       catch E2:R2:Stk2 ->
-        wf:error(?MODULE, "init: E:R:Stk: ~p ~p~n ~p~n", [E2, R2, Stk2]),
-        {stack, [E2, R2, Stk2]}
+        Err2 = [E2, R2, Stk2],
+        wf:error(?MODULE, "init: E:R:Stk: ~p ~p~n ~p~n", Err2),
+        {stack, Err2}
       end,
       Actions = render_actions(erlang:get(actions)),
       {reply, wf:format({io, erlang:iolist_to_binary([InitActions, Actions]), <<>>}),
@@ -51,8 +53,9 @@ info({pickle, _, _, _} = Event, Req, State) ->
   erlang:put(actions, []),
   Result = try html_events(Event, State)
   catch E:R:Stk ->
-    wf:error(?MODULE, "info pickle E:R:Stk: ~p ~p~n ~p~n", [E, R, Stk]),
-    {io, render_actions(erlang:get(actions)), [E, R, Stk]}
+    Err = [E, R, Stk],
+    wf:error(?MODULE, "info pickle E:R:Stk: ~p ~p~n ~p~n", Err),
+    {io, render_actions(erlang:get(actions)), Err}
   end,
   {reply, wf:format(Result), Req,
           n4u_cx:context(State, ?MODULE, {pickle, Result})};
@@ -71,8 +74,9 @@ info({direct, Message}, Req, State) ->
   Result = try Res = Module:event(Message),
     {direct, Res}
   catch E:R:Stk ->
-    wf:error(?MODULE, "info direct E:R:Stk: ~p ~p~n ~p~n", [E, R, Stk]),
-    {stack, [E, R, Stk]}
+    Err = [E, R, Stk],
+    wf:error(?MODULE, "info direct E:R:Stk: ~p ~p~n ~p~n", Err),
+    {stack, Err}
   end,
   {reply, wf:format({io, render_actions(erlang:get(actions)), <<>>}),
           Req, n4u_cx:context(State, ?MODULE, Result)};