summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2009-05-27 00:22:36 +0000
committerRobert Haas2009-05-27 00:22:36 +0000
commit56a77ed5047ac68a86ad3264fc77ead05b305d38 (patch)
tree5efde67dcae5daefc03062e1a04105512181ef77
parent8e5908f649d01afcab220d458cfa9bdf6b0d962d (diff)
Improve error handling in the case where patch_delete fails.
Per suggestion from Josh Tolley. Along the way, correct a dubious formatting choice in template/error.tt2.
-rw-r--r--perl-lib/PgCommitFest/Patch.pm10
-rw-r--r--template/error.tt22
-rw-r--r--template/patch_delete.tt21
3 files changed, 9 insertions, 4 deletions
diff --git a/perl-lib/PgCommitFest/Patch.pm b/perl-lib/PgCommitFest/Patch.pm
index b648e4a..3cf1e2a 100644
--- a/perl-lib/PgCommitFest/Patch.pm
+++ b/perl-lib/PgCommitFest/Patch.pm
@@ -21,11 +21,15 @@ EOM
$r->redirect('/action/commitfest_view?id=' . $d->{'commitfest_id'});
}
if ($err =~ /patch_comment_patch_id_fkey/) {
- $r->error_exit(<<EOM);
-Because this patch has one or more comments, it may not be deleted.
+ $r->error(<<EOM);
+Because this patch has one or more comments, it may not be deleted. Unless you
+are an administrator, you may only edit or delete your own comments.
EOM
}
- $r->error_exit("Internal error: $@");
+ else {
+ $r->error("Internal error: $@");
+ }
+ $r->render_template('patch_delete', { 'id' => $r->cgi_required_id });
}
sub form {
diff --git a/template/error.tt2 b/template/error.tt2
index 6e538fa..27feb21 100644
--- a/template/error.tt2
+++ b/template/error.tt2
@@ -1,3 +1,3 @@
[% FOREACH one_error_in_list = error_list %]
-<p class='error'>[% one_error_in_list | htmlsafe | html_line_break %]</p>
+<p class='error'>[% one_error_in_list | htmlsafe %]</p>
[% END %]
diff --git a/template/patch_delete.tt2 b/template/patch_delete.tt2
new file mode 100644
index 0000000..e4868cf
--- /dev/null
+++ b/template/patch_delete.tt2
@@ -0,0 +1 @@
+<p><a href='/https/git.postgresql.org/action/patch_view?id=[% id %]'>Return to Patch</a></p>