From 96d1a3af56b3d278bd0b8d76d7efb9aa94842ebd Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 25 May 2015 23:27:12 -0700 Subject: [PATCH] Drop Error::StreamDesynchronized --- src/error.rs | 6 ------ src/lib.rs | 5 +++++ src/macros.rs | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/error.rs b/src/error.rs index 958abcf5..4c06ccd1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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", diff --git a/src/lib.rs b/src/lib.rs index bc7906dc..4381972a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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) diff --git a/src/macros.rs b/src/macros.rs index dc5f178c..2a2b5275 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -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())); } }) }