From: Tara L Andrews Date: Wed, 19 Sep 2012 18:09:54 +0000 (+0200) Subject: show a helpful error for nonexistent tradition X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd3f7f5528671482924d75eb84d3e28868b7296f;p=scpubgit%2Fstemmaweb.git show a helpful error for nonexistent tradition --- diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index cd0b957..7e537d9 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -56,8 +56,14 @@ sub definitions :Local :Args(0) { sub text :Chained('/') :PathPart('relation') :CaptureArgs(1) { my( $self, $c, $textid ) = @_; - # If the tradition has more than 500 ranks or so, split it up. my $tradition = $c->model('Directory')->tradition( $textid ); + unless( $tradition ) { + $c->response->status('404'); + $c->response->body("No such tradition with ID $textid"); + $c->detach('View::Plain'); + return; + } + # Account for a bad interaction between FastCGI and KiokuDB unless( $tradition->collation->tradition ) { $c->log->warn( "Fixing broken tradition link" );