Show an error if a nonexistent order is viewed
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 5 Mar 2016 18:18:56 +0000 (18:18 +0000)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 5 Mar 2016 18:18:56 +0000 (18:18 +0000)
lib/App/Web/Oof.pm

index 2814ad3760b879b85193982019d69e91cb2b79e1..93ab4fe40d62e3096a8d9dae9cef2b947897a581 100644 (file)
@@ -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);
This page took 0.011013 seconds and 4 git commands to generate.