Drop Error::StreamDesynchronized

This commit is contained in:
Steven Fackler 2015-05-25 23:27:12 -07:00
parent f800835456
commit 96d1a3af56
3 changed files with 6 additions and 7 deletions

View File

@ -287,9 +287,6 @@ pub enum Error {
DbError(DbError),
/// An error communicating with the Postgres server.
IoError(io::Error),
/// The communication channel with the Postgres server has desynchronized
/// due to an earlier communications error.
StreamDesynchronized,
/// An attempt was made to convert between incompatible Rust and Postgres
/// types.
WrongType(Type),
@ -314,9 +311,6 @@ impl error::Error for Error {
match *self {
Error::DbError(_) => "An error reported by the Postgres server",
Error::IoError(_) => "An error communicating with the Postgres server",
Error::StreamDesynchronized => {
"Communication with the server has desynchronized due to an earlier IO error"
}
Error::WrongType(_) => "Unexpected type",
Error::InvalidColumn => "Invalid column",
Error::Conversion(_) => "An error converting between Postgres and Rust types",

View File

@ -406,6 +406,11 @@ fn bad_response() -> std_io::Error {
"the server returned an unexpected response")
}
fn desynchronized() -> std_io::Error {
std_io::Error::new(std_io::ErrorKind::Other,
"communication with the server has desynchronized due to an earlier IO error")
}
/// An enumeration of transaction isolation levels.
///
/// See the [Postgres documentation](http://www.postgresql.org/docs/9.4/static/transaction-iso.html)

View File

@ -13,7 +13,7 @@ macro_rules! try_desync {
macro_rules! check_desync {
($e:expr) => ({
if $e.is_desynchronized() {
return Err(::error::Error::StreamDesynchronized);
return Err(::error::Error::IoError(::desynchronized()));
}
})
}