[dw-free] Ugly error when trying to view the threadroot in a deleted entry or with a nonexistent com
[commit: http://hg.dwscoalition.org/dw-free/rev/8c3aebd4accd]
http://bugs.dwscoalition.org/show_bug.cgi?id=3680
Present a user-friendly error message rather than splashing a technical one
across the top of the page.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3680
Present a user-friendly error message rather than splashing a technical one
across the top of the page.
Patch by
Files modified:
- htdocs/go.bml
- htdocs/go.bml.text
--------------------------------------------------------------------------------
diff -r f344cabf9f80 -r 8c3aebd4accd htdocs/go.bml
--- a/htdocs/go.bml Tue May 17 10:39:03 2011 +0800
+++ b/htdocs/go.bml Tue May 17 13:14:19 2011 +0800
@@ -41,8 +41,15 @@
my $u = LJ::load_user( $journal );
return unless $u;
- my $comment = LJ::Comment->new( $u, dtalkid => $talkid );
- return unless $comment;
+ my $comment = eval { LJ::Comment->new( $u, dtalkid => $talkid ) };
+ if ( $@ ) {
+ $body = "<p>$ML{'.error.nocomment'}</p>";
+ return;
+ }
+ unless ( $comment->entry && $comment->entry->valid ) {
+ $body = "<p>$ML{'.error.noentry'}</p>";
+ return;
+ }
my $threadroot = LJ::Comment->new( $u, jtalkid => $comment->threadrootid );
return BML::redirect( $threadroot->url( LJ::viewing_style_args( %GET ) ) );
diff -r f344cabf9f80 -r 8c3aebd4accd htdocs/go.bml.text
--- a/htdocs/go.bml.text Tue May 17 10:39:03 2011 +0800
+++ b/htdocs/go.bml.text Tue May 17 13:14:19 2011 +0800
@@ -3,6 +3,10 @@
.defaulttitle=Error
+.error.nocomment=No such comment exists.
+
+.error.noentry=No such entry exists.
+
.error.noentry.next=There is no entry following this one.
.error.noentry.prev=There is no entry preceding this one.
--------------------------------------------------------------------------------
