File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ pub use postgres_shared::error;
20
20
#[ doc( inline) ]
21
21
pub use postgres_shared:: params;
22
22
23
- use error:: ConnectError ;
23
+ use error:: { ConnectError , DbError } ;
24
24
use params:: { ConnectParams , IntoConnectParams } ;
25
25
use stream:: PostgresStream ;
26
26
@@ -190,6 +190,9 @@ impl Connection {
190
190
}
191
191
}
192
192
}
193
+ backend:: Message :: ErrorResponse ( body) => {
194
+ DbError :: new_connect ( & mut body. fields ( ) )
195
+ }
193
196
_ => Err ( bad_message ( ) ) ,
194
197
} ;
195
198
@@ -212,6 +215,9 @@ impl Connection {
212
215
. and_then ( |( m, s) | {
213
216
match m {
214
217
backend:: Message :: AuthenticationOk => Ok ( Connection ( s) ) ,
218
+ backend:: Message :: ErrorResponse ( body) => {
219
+ DbError :: new_connect ( & mut body. fields ( ) )
220
+ }
215
221
_ => Err ( bad_message ( ) ) ,
216
222
}
217
223
} )
@@ -229,6 +235,9 @@ impl Connection {
229
235
Either :: A ( Connection ( s) . finish_startup ( ) )
230
236
}
231
237
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
+ }
232
241
_ => Either :: B ( Err ( bad_message ( ) ) . into_future ( ) ) ,
233
242
}
234
243
} )
You can’t perform that action at this time.
0 commit comments