File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ pub use postgres_shared::error;
2020#[ doc( inline) ]
2121pub use postgres_shared:: params;
2222
23- use error:: ConnectError ;
23+ use error:: { ConnectError , DbError } ;
2424use params:: { ConnectParams , IntoConnectParams } ;
2525use stream:: PostgresStream ;
2626
@@ -190,6 +190,9 @@ impl Connection {
190190 }
191191 }
192192 }
193+ backend:: Message :: ErrorResponse ( body) => {
194+ DbError :: new_connect ( & mut body. fields ( ) )
195+ }
193196 _ => Err ( bad_message ( ) ) ,
194197 } ;
195198
@@ -212,6 +215,9 @@ impl Connection {
212215 . and_then ( |( m, s) | {
213216 match m {
214217 backend:: Message :: AuthenticationOk => Ok ( Connection ( s) ) ,
218+ backend:: Message :: ErrorResponse ( body) => {
219+ DbError :: new_connect ( & mut body. fields ( ) )
220+ }
215221 _ => Err ( bad_message ( ) ) ,
216222 }
217223 } )
@@ -229,6 +235,9 @@ impl Connection {
229235 Either :: A ( Connection ( s) . finish_startup ( ) )
230236 }
231237 backend:: Message :: ReadyForQuery ( _) => Either :: B ( Ok ( Connection ( s) ) . into_future ( ) ) ,
238+ backend:: Message :: ErrorResponse ( body) => {
239+ Either :: B ( DbError :: new_connect ( & mut body. fields ( ) ) . into_future ( ) )
240+ }
232241 _ => Either :: B ( Err ( bad_message ( ) ) . into_future ( ) ) ,
233242 }
234243 } )
You can’t perform that action at this time.
0 commit comments