common: treat exception references as alert parameters
[sheet.git] / common.inc.plp
index f7ca70023bf9a7ff386cb5a9fabbebc37117e465..71c5c1379f29aeb82d6d1211ec53dff69740d2cf 100644 (file)
@@ -78,7 +78,7 @@ sub stylesheet {
 
        return map { sprintf(
                '<link rel="%s" type="text/css" media="all" href="%s" title="%s">',
-               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.12", $_
+               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.13", $_
        ) } @avail;
 }
 
@@ -196,13 +196,20 @@ EOT
 
 BEGIN {
        $PLP::ERROR = sub {
-               my ($text, $html) = @_;
-               warn $text;
+               my ($message, $html) = @_;
+               if (ref $message) {
+                       warn join ': ', @{$message};
+                       $html = shift @{$message};
+               }
+               else {
+                       warn $message;
+                       $message = [];
+               }
                unless ($PLP::sentheaders) {
                        Html({nocache => 1});
                        say '<h1>Page unavailable</h1>';
                }
-               Alert("<strong>Fatal error</strong>: $html.");
+               Alert("Fatal error: $html.", @{$message});
        };
 }