From 85e0d9a252dc252b9f79df382ed14d07ffb688c3 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 5 Mar 2016 18:18:56 +0000 Subject: [PATCH] Show an error if a nonexistent order is viewed --- lib/App/Web/Oof.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.30.2