Skip to content

Commit ef3de8a

Browse files
committed
Merge branch 'release-v0.10.0' into release
2 parents fc2ae1d + be7a0f2 commit ef3de8a

File tree

9 files changed

+314
-291
lines changed

9 files changed

+314
-291
lines changed

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "postgres"
3-
version = "0.9.6"
3+
version = "0.10.0"
44
authors = ["Steven Fackler <[email protected]>"]
55
license = "MIT"
66
description = "A native PostgreSQL driver"
77
repository = "https://github.com/sfackler/rust-postgres"
8-
documentation = "https://sfackler.github.io/rust-postgres/doc/v0.9.6/postgres"
8+
documentation = "https://sfackler.github.io/rust-postgres/doc/v0.10.0/postgres"
99
readme = "README.md"
1010
keywords = ["database", "sql"]
1111
build = "build.rs"
@@ -26,7 +26,6 @@ phf_codegen = "0.7"
2626
[dependencies]
2727
bufstream = "0.1"
2828
byteorder = "0.3"
29-
debug-builders = "0.1"
3029
log = "0.3"
3130
phf = "0.7"
3231
rustc-serialize = "0.3"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Rust-Postgres
22
A native PostgreSQL driver for Rust.
33

4-
[Documentation](https://sfackler.github.io/rust-postgres/doc/v0.9.6/postgres)
4+
[Documentation](https://sfackler.github.io/rust-postgres/doc/v0.10.0/postgres)
55

66
[![Build Status](https://travis-ci.org/sfackler/rust-postgres.png?branch=master)](https://travis-ci.org/sfackler/rust-postgres) [![Latest Version](https://img.shields.io/crates/v/postgres.svg)](https://crates.io/crates/postgres)
77

88
You can integrate Rust-Postgres into your project through the [releases on crates.io](https://crates.io/crates/postgres):
99
```toml
1010
# Cargo.toml
1111
[dependencies]
12-
postgres = "0.9"
12+
postgres = "0.10"
1313
```
1414

1515
## Overview
@@ -57,7 +57,7 @@ fn main() {
5757
```
5858

5959
## Requirements
60-
* **Rust** - Rust-Postgres is developed against the 1.0 release of Rust
60+
* **Rust** - Rust-Postgres is developed against the 1.2 release of Rust
6161
available on http://www.rust-lang.org. It should also compile against more
6262
recent releases.
6363

src/error.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ impl DbErrorNew for DbError {
6767

6868
fn new_connect<T>(fields: Vec<(u8, String)>) -> result::Result<T, ConnectError> {
6969
match DbError::new_raw(fields) {
70-
Ok(err) => Err(ConnectError::DbError(err)),
70+
Ok(err) => Err(ConnectError::DbError(Box::new(err))),
7171
Err(()) => Err(ConnectError::IoError(::bad_response())),
7272
}
7373
}
7474

7575
fn new<T>(fields: Vec<(u8, String)>) -> Result<T> {
7676
match DbError::new_raw(fields) {
77-
Ok(err) => Err(Error::DbError(err)),
77+
Ok(err) => Err(Error::DbError(Box::new(err))),
7878
Err(()) => Err(Error::IoError(::bad_response())),
7979
}
8080
}
@@ -193,30 +193,30 @@ impl error::Error for DbError {
193193
/// Reasons a new Postgres connection could fail.
194194
#[derive(Debug)]
195195
pub enum ConnectError {
196-
/// The provided URL could not be parsed.
197-
InvalidUrl(String),
198-
/// The URL was missing a user.
196+
/// An error creating `ConnectParams`.
197+
BadConnectParams(Box<error::Error+Sync+Send>),
198+
/// The `ConnectParams` was missing a user.
199199
MissingUser,
200200
/// An error from the Postgres server itself.
201-
DbError(DbError),
202-
/// A password was required but not provided in the URL.
201+
DbError(Box<DbError>),
202+
/// A password was required but not provided in the `ConnectParams`.
203203
MissingPassword,
204204
/// The Postgres server requested an authentication method not supported
205205
/// by the driver.
206206
UnsupportedAuthentication,
207207
/// The Postgres server does not support SSL encryption.
208208
NoSslSupport,
209-
/// There was an error initializing the SSL session.
209+
/// An error initializing the SSL session.
210210
SslError(Box<error::Error+Sync+Send>),
211-
/// There was an error communicating with the server.
211+
/// An error communicating with the server.
212212
IoError(io::Error),
213213
}
214214

215215
impl fmt::Display for ConnectError {
216216
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
217217
try!(fmt.write_str(error::Error::description(self)));
218218
match *self {
219-
ConnectError::InvalidUrl(ref msg) => write!(fmt, ": {}", msg),
219+
ConnectError::BadConnectParams(ref msg) => write!(fmt, ": {}", msg),
220220
ConnectError::DbError(ref err) => write!(fmt, ": {}", err),
221221
ConnectError::SslError(ref err) => write!(fmt, ": {}", err),
222222
ConnectError::IoError(ref err) => write!(fmt, ": {}", err),
@@ -228,8 +228,8 @@ impl fmt::Display for ConnectError {
228228
impl error::Error for ConnectError {
229229
fn description(&self) -> &str {
230230
match *self {
231-
ConnectError::InvalidUrl(_) => "Invalid URL",
232-
ConnectError::MissingUser => "User missing in URL",
231+
ConnectError::BadConnectParams(_) => "Error creating `ConnectParams`",
232+
ConnectError::MissingUser => "User missing in `ConnectParams`",
233233
ConnectError::DbError(_) => "Error reported by Postgres",
234234
ConnectError::MissingPassword => "The server requested a password but none was provided",
235235
ConnectError::UnsupportedAuthentication => {
@@ -243,7 +243,8 @@ impl error::Error for ConnectError {
243243

244244
fn cause(&self) -> Option<&error::Error> {
245245
match *self {
246-
ConnectError::DbError(ref err) => Some(err),
246+
ConnectError::BadConnectParams(ref err) => Some(&**err),
247+
ConnectError::DbError(ref err) => Some(&**err),
247248
ConnectError::SslError(ref err) => Some(&**err),
248249
ConnectError::IoError(ref err) => Some(err),
249250
_ => None
@@ -259,7 +260,7 @@ impl From<io::Error> for ConnectError {
259260

260261
impl From<DbError> for ConnectError {
261262
fn from(err: DbError) -> ConnectError {
262-
ConnectError::DbError(err)
263+
ConnectError::DbError(Box::new(err))
263264
}
264265
}
265266

@@ -287,7 +288,7 @@ pub enum ErrorPosition {
287288
#[derive(Debug)]
288289
pub enum Error {
289290
/// An error reported by the Postgres server.
290-
DbError(DbError),
291+
DbError(Box<DbError>),
291292
/// An error communicating with the Postgres server.
292293
IoError(io::Error),
293294
/// An attempt was made to convert between incompatible Rust and Postgres
@@ -325,7 +326,7 @@ impl error::Error for Error {
325326

326327
fn cause(&self) -> Option<&error::Error> {
327328
match *self {
328-
Error::DbError(ref err) => Some(err),
329+
Error::DbError(ref err) => Some(&**err),
329330
Error::IoError(ref err) => Some(err),
330331
Error::Conversion(ref err) => Some(&**err),
331332
_ => None
@@ -335,7 +336,7 @@ impl error::Error for Error {
335336

336337
impl From<DbError> for Error {
337338
fn from(err: DbError) -> Error {
338-
Error::DbError(err)
339+
Error::DbError(Box::new(err))
339340
}
340341
}
341342

0 commit comments

Comments
 (0)