Browse Source

send error response

Anton Lebedevich 13 years ago
parent
commit
d902396e99
1 changed files with 5 additions and 6 deletions
  1. 5 6
      src/pgsql_sock.erl

+ 5 - 6
src/pgsql_sock.erl

@@ -179,8 +179,7 @@ auth({$R, <<M:?int32, _/binary>>}, State) ->
         _ -> Method = unknown
         _ -> Method = unknown
     end,
     end,
     Error = {error, {unsupported_auth_method, Method}},
     Error = {error, {unsupported_auth_method, Method}},
-    %% TODO send error response
-    {stop, Error, State};
+    {stop, Error, reply(State, Error)};
 
 
 %% ErrorResponse
 %% ErrorResponse
 %% TODO who decodes error ?
 %% TODO who decodes error ?
@@ -190,12 +189,12 @@ auth({error, E}, State) ->
         <<"28P01">> -> Why = invalid_password;
         <<"28P01">> -> Why = invalid_password;
         Any         -> Why = Any
         Any         -> Why = Any
     end,
     end,
-    %% TODO send error response
-    {stop, {error, Why}, State};
+    Error = {error, Why},
+    {stop, Error, reply(State, Error)};
 
 
 auth(timeout, State) ->
 auth(timeout, State) ->
-    %% TODO send error response
-    {stop, {error, timeout}, State}.
+    Error = {error, timeout},
+    {stop, Error, reply(State, Error)}.
 
 
 initializing(timeout, State) ->
 initializing(timeout, State) ->
     %% TODO send error response
     %% TODO send error response