From: Marius Gavrilescu Date: Sat, 5 Mar 2016 18:18:56 +0000 (+0000) Subject: Show an error if a nonexistent order is viewed X-Git-Tag: 0.000_004~1 X-Git-Url: http://git.ieval.ro/?p=app-web-oof.git;a=commitdiff_plain;h=85e0d9a252dc252b9f79df382ed14d07ffb688c3 Show an error if a nonexistent order is viewed --- diff --git a/lib/App/Web/Oof.pm b/lib/App/Web/Oof.pm index 2814ad3..93ab4fe 100644 --- a/lib/App/Web/Oof.pm +++ b/lib/App/Web/Oof.pm @@ -164,7 +164,8 @@ sub order_app { my $req = Plack::Request->new($env); my ($id) = $env->{PATH_INFO} =~ m,^/([0-9A-F]+),; if ($id) { - my $total = $db{$$}->select(orders => 'total', {id => $id})->list; + my $total = $db{$$}->select(orders => 'total', {id => $id})->list or + return [500, ['Content-type', 'text/plain'], ['Order not found']]; $tree->fid('orderid')->replace_content($id); $tree->look_down(name => 'order')->attr(value => $id); $tree->fid('total')->replace_content(stringify_money $total);