From 88048e2c00e3e9a9c172e788722354017cd401ec Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 14 May 2022 16:35:50 +0200 Subject: [PATCH] common: treat exception references as alert parameters Pass on debug messages from (possibly trapped) perl/plp errors. --- common.inc.plp | 13 ++++++++++--- latin.plp | 12 +++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/common.inc.plp b/common.inc.plp index 2483504..71c5c13 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -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 '

Page unavailable

'; } - Alert("Fatal error: $html."); + Alert("Fatal error: $html.", @{$message}); }; } diff --git a/latin.plp b/latin.plp index f9453e6..a86f2ca 100644 --- a/latin.plp +++ b/latin.plp @@ -47,16 +47,15 @@ or 'mercan) letters A–Z. Also see related alphabets and font comparison.

-
- <: use List::Util qw( pairs ); my @table = do 'writing-latn.inc.pl'; -if ($! or $@) { - Alert("Table data not found", $@ || $!); +if ($! or $@ or !@table) { + die ["Table data not found", $@ || $!]; } else { + say '
'; say '