Skip to content

Commit 8ae9636

Browse files
committed
Forward errors from statement and portal cleanup
1 parent f8a5bd3 commit 8ae9636

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ fn main() {
6363
#[warn(missing_doc)];
6464

6565
#[feature(macro_rules, struct_variant, globs, phase)];
66-
#[macro_escape];
6766

6867
extern mod collections;
6968
extern mod extra;
@@ -1080,9 +1079,12 @@ impl<'conn> NormalPostgresStatement<'conn> {
10801079
},
10811080
Sync]));
10821081
loop {
1083-
// TODO forward db errors
10841082
match if_ok_pg!(self.conn.read_message()) {
10851083
ReadyForQuery { .. } => break,
1084+
ErrorResponse { fields } => {
1085+
if_ok!(self.conn.wait_for_ready());
1086+
return Err(PgDbError(PostgresDbError::new(fields)));
1087+
}
10861088
_ => {}
10871089
}
10881090
}
@@ -1322,9 +1324,12 @@ impl<'stmt> PostgresResult<'stmt> {
13221324
},
13231325
Sync]));
13241326
loop {
1325-
// TODO forward PG errors
13261327
match if_ok_pg!(self.stmt.conn.read_message()) {
13271328
ReadyForQuery { .. } => break,
1329+
ErrorResponse { fields } => {
1330+
if_ok!(self.stmt.conn.wait_for_ready());
1331+
return Err(PgDbError(PostgresDbError::new(fields)));
1332+
}
13281333
_ => {}
13291334
}
13301335
}

0 commit comments

Comments
 (0)