Forward errors from statement and portal cleanup

This commit is contained in:
Steven Fackler 2014-02-11 23:07:34 -08:00
parent f8a5bd3009
commit 8ae9636422

View File

@ -63,7 +63,6 @@ fn main() {
#[warn(missing_doc)]; #[warn(missing_doc)];
#[feature(macro_rules, struct_variant, globs, phase)]; #[feature(macro_rules, struct_variant, globs, phase)];
#[macro_escape];
extern mod collections; extern mod collections;
extern mod extra; extern mod extra;
@ -1080,9 +1079,12 @@ impl<'conn> NormalPostgresStatement<'conn> {
}, },
Sync])); Sync]));
loop { loop {
// TODO forward db errors
match if_ok_pg!(self.conn.read_message()) { match if_ok_pg!(self.conn.read_message()) {
ReadyForQuery { .. } => break, ReadyForQuery { .. } => break,
ErrorResponse { fields } => {
if_ok!(self.conn.wait_for_ready());
return Err(PgDbError(PostgresDbError::new(fields)));
}
_ => {} _ => {}
} }
} }
@ -1322,9 +1324,12 @@ impl<'stmt> PostgresResult<'stmt> {
}, },
Sync])); Sync]));
loop { loop {
// TODO forward PG errors
match if_ok_pg!(self.stmt.conn.read_message()) { match if_ok_pg!(self.stmt.conn.read_message()) {
ReadyForQuery { .. } => break, ReadyForQuery { .. } => break,
ErrorResponse { fields } => {
if_ok!(self.stmt.conn.wait_for_ready());
return Err(PgDbError(PostgresDbError::new(fields)));
}
_ => {} _ => {}
} }
} }