Mercurial > urweb
changeset 688:829887ca47a6
Detect serialization failures
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 02 Apr 2009 13:31:13 -0400 |
parents | a3ddf05fb3e3 |
children | b6a8425e1b1f |
files | src/cjr_print.sml |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cjr_print.sml Thu Apr 02 11:42:26 2009 -0400 +++ b/src/cjr_print.sml Thu Apr 02 13:31:13 2009 -0400 @@ -1645,7 +1645,15 @@ string "if (PQresultStatus(res) != PGRES_COMMAND_OK) {", newline, - box [string "PQclear(res);", + box [string "if (!strcmp(PQresultErrorField(res, PG_DIAG_SQLSTATE), \"40001\")) {", + box [newline, + string "PQclear(res);", + newline, + string "uw_error(ctx, UNLIMITED_RETRY, \"Serialization failure\");", + newline], + string "}", + newline, + string "PQclear(res);", newline, string "uw_error(ctx, FATAL, \"", string (ErrorMsg.spanToString loc),