show SQL errors
[APKPM.git] / web_ui.pl
index 59752b9..2c70fd4 100755 (executable)
--- a/web_ui.pl
+++ b/web_ui.pl
@@ -97,8 +97,9 @@ get '/gnuplot' => sub {
        die "no result for $sql" unless $ret;
 
        $ret = Mojo::JSON->new->decode( $ret );
-
-       $ret->{error} = 'query run longer than ' . $gearman->timeout . ' s timeout' unless ref $ret->{columns} eq 'ARRAY';
+       
+       $ret->{error} = 'query run longer than ' . $gearman->timeout . ' s timeout'
+               if ! exists $ret->{error} && ref $ret->{columns} ne 'ARRAY';
 
        return $self->render('gnuplot', sql => $sql, img => '', gnuplot => $ret->{error} )
                if exists $ret->{error};