Closed kraftp closed 1 month ago
I wrote a test to try and replicate this issue, but DBOS persisted the error in tx output table as expected.
jansommer provided a repro. In his repro, he has a DB function that raises an error:
create function xx() returns void as $$
begin raise 'password_too_short'; end
$$ language plpgsql;
and a @Transaction method that calls it
@Transaction()
static async root(ctxt: TransactionContext<Knex>) {
return await ctxt.client.raw("select xx()")
}
so far, so good. However, if he tries to catch the exception in the method, we fail to save the transaction output because the raise
statement aborted the db transaction.
{
"status": 500,
"message": "INSERT INTO dbos.transaction_outputs (workflow_uuid, function_id, output, txn_id, txn_snapshot, created_at) VALUES ($1, $2, $3, (select pg_current_xact_id_if_assigned()::text), $4, $5) RETURNING txn_id; - current transaction is aborted, commands ignored until end of transaction block",
"details": {
"length": 145,
"name": "error",
"severity": "ERROR",
"code": "25P02",
"file": "postgres.c",
"line": "1498",
"routine": "exec_parse_message",
"dbos_already_logged": true
}
}
Original context from jansommer on Discord: