@@ -174,19 +174,10 @@ impl error::Error for DbError {
174174/// Reasons a new Postgres connection could fail.
175175#[ derive( Debug ) ]
176176pub enum ConnectError {
177- /// An error creating `ConnectParams`.
178- BadConnectParams ( Box < error:: Error + Sync + Send > ) ,
179- /// The `ConnectParams` was missing a user.
180- MissingUser ,
177+ /// An error relating to connection parameters.
178+ ConnectParams ( Box < error:: Error + Sync + Send > ) ,
181179 /// An error from the Postgres server itself.
182180 Db ( Box < DbError > ) ,
183- /// A password was required but not provided in the `ConnectParams`.
184- MissingPassword ,
185- /// The Postgres server requested an authentication method not supported
186- /// by the driver.
187- UnsupportedAuthentication ,
188- /// The Postgres server does not support SSL encryption.
189- NoSslSupport ,
190181 /// An error initializing the SSL session.
191182 Ssl ( Box < error:: Error + Sync + Send > ) ,
192183 /// An error communicating with the server.
@@ -197,40 +188,30 @@ impl fmt::Display for ConnectError {
197188 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
198189 try!( fmt. write_str ( error:: Error :: description ( self ) ) ) ;
199190 match * self {
200- ConnectError :: BadConnectParams ( ref msg) => write ! ( fmt, ": {}" , msg) ,
191+ ConnectError :: ConnectParams ( ref msg) => write ! ( fmt, ": {}" , msg) ,
201192 ConnectError :: Db ( ref err) => write ! ( fmt, ": {}" , err) ,
202193 ConnectError :: Ssl ( ref err) => write ! ( fmt, ": {}" , err) ,
203194 ConnectError :: Io ( ref err) => write ! ( fmt, ": {}" , err) ,
204- _ => Ok ( ( ) ) ,
205195 }
206196 }
207197}
208198
209199impl error:: Error for ConnectError {
210200 fn description ( & self ) -> & str {
211201 match * self {
212- ConnectError :: BadConnectParams ( _) => "Error creating `ConnectParams`" ,
213- ConnectError :: MissingUser => "User missing in `ConnectParams`" ,
202+ ConnectError :: ConnectParams ( _) => "Invalid connection parameters" ,
214203 ConnectError :: Db ( _) => "Error reported by Postgres" ,
215- ConnectError :: MissingPassword => {
216- "The server requested a password but none was provided"
217- }
218- ConnectError :: UnsupportedAuthentication => {
219- "The server requested an unsupported authentication method"
220- }
221- ConnectError :: NoSslSupport => "The server does not support SSL" ,
222204 ConnectError :: Ssl ( _) => "Error initiating SSL session" ,
223205 ConnectError :: Io ( _) => "Error communicating with the server" ,
224206 }
225207 }
226208
227209 fn cause ( & self ) -> Option < & error:: Error > {
228210 match * self {
229- ConnectError :: BadConnectParams ( ref err) => Some ( & * * err) ,
211+ ConnectError :: ConnectParams ( ref err) => Some ( & * * err) ,
230212 ConnectError :: Db ( ref err) => Some ( & * * err) ,
231213 ConnectError :: Ssl ( ref err) => Some ( & * * err) ,
232214 ConnectError :: Io ( ref err) => Some ( err) ,
233- _ => None ,
234215 }
235216 }
236217}
0 commit comments