Rename ConnectError::Ssl to Tls

This commit is contained in:
Steven Fackler 2016-09-17 15:05:07 -07:00
parent 25ba140ac8
commit cea7423cd3
2 changed files with 7 additions and 7 deletions

View File

@ -177,8 +177,8 @@ pub enum ConnectError {
ConnectParams(Box<error::Error + Sync + Send>), ConnectParams(Box<error::Error + Sync + Send>),
/// An error from the Postgres server itself. /// An error from the Postgres server itself.
Db(Box<DbError>), Db(Box<DbError>),
/// An error initializing the SSL session. /// An error initializing the TLS session.
Ssl(Box<error::Error + Sync + Send>), Tls(Box<error::Error + Sync + Send>),
/// An error communicating with the server. /// An error communicating with the server.
Io(io::Error), Io(io::Error),
} }
@ -189,7 +189,7 @@ impl fmt::Display for ConnectError {
match *self { match *self {
ConnectError::ConnectParams(ref msg) => write!(fmt, ": {}", msg), ConnectError::ConnectParams(ref msg) => write!(fmt, ": {}", msg),
ConnectError::Db(ref err) => write!(fmt, ": {}", err), ConnectError::Db(ref err) => write!(fmt, ": {}", err),
ConnectError::Ssl(ref err) => write!(fmt, ": {}", err), ConnectError::Tls(ref err) => write!(fmt, ": {}", err),
ConnectError::Io(ref err) => write!(fmt, ": {}", err), ConnectError::Io(ref err) => write!(fmt, ": {}", err),
} }
} }
@ -200,7 +200,7 @@ impl error::Error for ConnectError {
match *self { match *self {
ConnectError::ConnectParams(_) => "Invalid connection parameters", ConnectError::ConnectParams(_) => "Invalid connection parameters",
ConnectError::Db(_) => "Error reported by Postgres", ConnectError::Db(_) => "Error reported by Postgres",
ConnectError::Ssl(_) => "Error initiating SSL session", ConnectError::Tls(_) => "Error initiating SSL session",
ConnectError::Io(_) => "Error communicating with the server", ConnectError::Io(_) => "Error communicating with the server",
} }
} }
@ -208,7 +208,7 @@ impl error::Error for ConnectError {
fn cause(&self) -> Option<&error::Error> { fn cause(&self) -> Option<&error::Error> {
match *self { match *self {
ConnectError::ConnectParams(ref err) | ConnectError::ConnectParams(ref err) |
ConnectError::Ssl(ref err) => Some(&**err), ConnectError::Tls(ref err) => Some(&**err),
ConnectError::Db(ref err) => Some(&**err), ConnectError::Db(ref err) => Some(&**err),
ConnectError::Io(ref err) => Some(err), ConnectError::Io(ref err) => Some(err),
} }

View File

@ -252,7 +252,7 @@ pub fn initialize_stream(params: &ConnectParams,
if try!(socket.read_u8()) == b'N' { if try!(socket.read_u8()) == b'N' {
if tls_required { if tls_required {
return Err(ConnectError::Ssl("the server does not support TLS".into())); return Err(ConnectError::Tls("the server does not support TLS".into()));
} else { } else {
return Ok(Box::new(socket)); return Ok(Box::new(socket));
} }
@ -264,5 +264,5 @@ pub fn initialize_stream(params: &ConnectParams,
ConnectTarget::Unix(_) => return Err(ConnectError::Io(::bad_response())), ConnectTarget::Unix(_) => return Err(ConnectError::Io(::bad_response())),
}; };
handshaker.tls_handshake(host, socket).map_err(ConnectError::Ssl) handshaker.tls_handshake(host, socket).map_err(ConnectError::Tls)
} }