@@ -124,15 +124,15 @@ impl DbErrorNew for DbError {
124
124
125
125
fn new_connect < T > ( fields : Vec < ( u8 , String ) > ) -> result:: Result < T , ConnectError > {
126
126
match DbError :: new_raw ( fields) {
127
- Ok ( err) => Err ( ConnectError :: DbError ( Box :: new ( err) ) ) ,
128
- Err ( ( ) ) => Err ( ConnectError :: IoError ( :: bad_response ( ) ) ) ,
127
+ Ok ( err) => Err ( ConnectError :: Db ( Box :: new ( err) ) ) ,
128
+ Err ( ( ) ) => Err ( ConnectError :: Io ( :: bad_response ( ) ) ) ,
129
129
}
130
130
}
131
131
132
132
fn new < T > ( fields : Vec < ( u8 , String ) > ) -> Result < T > {
133
133
match DbError :: new_raw ( fields) {
134
- Ok ( err) => Err ( Error :: DbError ( Box :: new ( err) ) ) ,
135
- Err ( ( ) ) => Err ( Error :: IoError ( :: bad_response ( ) ) ) ,
134
+ Ok ( err) => Err ( Error :: Db ( Box :: new ( err) ) ) ,
135
+ Err ( ( ) ) => Err ( Error :: Io ( :: bad_response ( ) ) ) ,
136
136
}
137
137
}
138
138
}
@@ -180,7 +180,7 @@ pub enum ConnectError {
180
180
/// The `ConnectParams` was missing a user.
181
181
MissingUser ,
182
182
/// An error from the Postgres server itself.
183
- DbError ( Box < DbError > ) ,
183
+ Db ( Box < DbError > ) ,
184
184
/// A password was required but not provided in the `ConnectParams`.
185
185
MissingPassword ,
186
186
/// The Postgres server requested an authentication method not supported
@@ -189,19 +189,19 @@ pub enum ConnectError {
189
189
/// The Postgres server does not support SSL encryption.
190
190
NoSslSupport ,
191
191
/// An error initializing the SSL session.
192
- SslError ( Box < error:: Error + Sync + Send > ) ,
192
+ Ssl ( Box < error:: Error + Sync + Send > ) ,
193
193
/// An error communicating with the server.
194
- IoError ( io:: Error ) ,
194
+ Io ( io:: Error ) ,
195
195
}
196
196
197
197
impl fmt:: Display for ConnectError {
198
198
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
199
199
try!( fmt. write_str ( error:: Error :: description ( self ) ) ) ;
200
200
match * self {
201
201
ConnectError :: BadConnectParams ( ref msg) => write ! ( fmt, ": {}" , msg) ,
202
- ConnectError :: DbError ( ref err) => write ! ( fmt, ": {}" , err) ,
203
- ConnectError :: SslError ( ref err) => write ! ( fmt, ": {}" , err) ,
204
- ConnectError :: IoError ( ref err) => write ! ( fmt, ": {}" , err) ,
202
+ ConnectError :: Db ( ref err) => write ! ( fmt, ": {}" , err) ,
203
+ ConnectError :: Ssl ( ref err) => write ! ( fmt, ": {}" , err) ,
204
+ ConnectError :: Io ( ref err) => write ! ( fmt, ": {}" , err) ,
205
205
_ => Ok ( ( ) ) ,
206
206
}
207
207
}
@@ -212,45 +212,45 @@ impl error::Error for ConnectError {
212
212
match * self {
213
213
ConnectError :: BadConnectParams ( _) => "Error creating `ConnectParams`" ,
214
214
ConnectError :: MissingUser => "User missing in `ConnectParams`" ,
215
- ConnectError :: DbError ( _) => "Error reported by Postgres" ,
215
+ ConnectError :: Db ( _) => "Error reported by Postgres" ,
216
216
ConnectError :: MissingPassword => {
217
217
"The server requested a password but none was provided"
218
218
}
219
219
ConnectError :: UnsupportedAuthentication => {
220
220
"The server requested an unsupported authentication method"
221
221
}
222
222
ConnectError :: NoSslSupport => "The server does not support SSL" ,
223
- ConnectError :: SslError ( _) => "Error initiating SSL session" ,
224
- ConnectError :: IoError ( _) => "Error communicating with the server" ,
223
+ ConnectError :: Ssl ( _) => "Error initiating SSL session" ,
224
+ ConnectError :: Io ( _) => "Error communicating with the server" ,
225
225
}
226
226
}
227
227
228
228
fn cause ( & self ) -> Option < & error:: Error > {
229
229
match * self {
230
230
ConnectError :: BadConnectParams ( ref err) => Some ( & * * err) ,
231
- ConnectError :: DbError ( ref err) => Some ( & * * err) ,
232
- ConnectError :: SslError ( ref err) => Some ( & * * err) ,
233
- ConnectError :: IoError ( ref err) => Some ( err) ,
231
+ ConnectError :: Db ( ref err) => Some ( & * * err) ,
232
+ ConnectError :: Ssl ( ref err) => Some ( & * * err) ,
233
+ ConnectError :: Io ( ref err) => Some ( err) ,
234
234
_ => None ,
235
235
}
236
236
}
237
237
}
238
238
239
239
impl From < io:: Error > for ConnectError {
240
240
fn from ( err : io:: Error ) -> ConnectError {
241
- ConnectError :: IoError ( err)
241
+ ConnectError :: Io ( err)
242
242
}
243
243
}
244
244
245
245
impl From < DbError > for ConnectError {
246
246
fn from ( err : DbError ) -> ConnectError {
247
- ConnectError :: DbError ( Box :: new ( err) )
247
+ ConnectError :: Db ( Box :: new ( err) )
248
248
}
249
249
}
250
250
251
251
impl From < byteorder:: Error > for ConnectError {
252
252
fn from ( err : byteorder:: Error ) -> ConnectError {
253
- ConnectError :: IoError ( From :: from ( err) )
253
+ ConnectError :: Io ( From :: from ( err) )
254
254
}
255
255
}
256
256
@@ -272,9 +272,9 @@ pub enum ErrorPosition {
272
272
#[ derive( Debug ) ]
273
273
pub enum Error {
274
274
/// An error reported by the Postgres server.
275
- DbError ( Box < DbError > ) ,
275
+ Db ( Box < DbError > ) ,
276
276
/// An error communicating with the Postgres server.
277
- IoError ( io:: Error ) ,
277
+ Io ( io:: Error ) ,
278
278
/// An attempt was made to convert between incompatible Rust and Postgres
279
279
/// types.
280
280
WrongType ( Type ) ,
@@ -286,8 +286,8 @@ impl fmt::Display for Error {
286
286
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
287
287
try!( fmt. write_str ( error:: Error :: description ( self ) ) ) ;
288
288
match * self {
289
- Error :: DbError ( ref err) => write ! ( fmt, ": {}" , err) ,
290
- Error :: IoError ( ref err) => write ! ( fmt, ": {}" , err) ,
289
+ Error :: Db ( ref err) => write ! ( fmt, ": {}" , err) ,
290
+ Error :: Io ( ref err) => write ! ( fmt, ": {}" , err) ,
291
291
Error :: WrongType ( ref ty) => write ! ( fmt, ": saw type {:?}" , ty) ,
292
292
Error :: Conversion ( ref err) => write ! ( fmt, ": {}" , err) ,
293
293
}
@@ -297,17 +297,17 @@ impl fmt::Display for Error {
297
297
impl error:: Error for Error {
298
298
fn description ( & self ) -> & str {
299
299
match * self {
300
- Error :: DbError ( _) => "Error reported by Postgres" ,
301
- Error :: IoError ( _) => "Error communicating with the server" ,
300
+ Error :: Db ( _) => "Error reported by Postgres" ,
301
+ Error :: Io ( _) => "Error communicating with the server" ,
302
302
Error :: WrongType ( _) => "Unexpected type" ,
303
303
Error :: Conversion ( _) => "Error converting between Postgres and Rust types" ,
304
304
}
305
305
}
306
306
307
307
fn cause ( & self ) -> Option < & error:: Error > {
308
308
match * self {
309
- Error :: DbError ( ref err) => Some ( & * * err) ,
310
- Error :: IoError ( ref err) => Some ( err) ,
309
+ Error :: Db ( ref err) => Some ( & * * err) ,
310
+ Error :: Io ( ref err) => Some ( err) ,
311
311
Error :: Conversion ( ref err) => Some ( & * * err) ,
312
312
_ => None ,
313
313
}
@@ -316,19 +316,19 @@ impl error::Error for Error {
316
316
317
317
impl From < DbError > for Error {
318
318
fn from ( err : DbError ) -> Error {
319
- Error :: DbError ( Box :: new ( err) )
319
+ Error :: Db ( Box :: new ( err) )
320
320
}
321
321
}
322
322
323
323
impl From < io:: Error > for Error {
324
324
fn from ( err : io:: Error ) -> Error {
325
- Error :: IoError ( err)
325
+ Error :: Io ( err)
326
326
}
327
327
}
328
328
329
329
impl From < byteorder:: Error > for Error {
330
330
fn from ( err : byteorder:: Error ) -> Error {
331
- Error :: IoError ( From :: from ( err) )
331
+ Error :: Io ( From :: from ( err) )
332
332
}
333
333
}
334
334
0 commit comments