From c4c96c7716df32cdb64927f09af4a35b1cab7aeb Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 21 Mar 2012 10:34:47 -0700 Subject: [PATCH] make more verbose error messages --- sweavealike.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sweavealike.pm b/sweavealike.pm index ec6660c..661a431 100644 --- a/sweavealike.pm +++ b/sweavealike.pm @@ -58,7 +58,9 @@ sub preprocess { # we currently don't bother to support anything but outputing the # entire segment of code and its R output - if (not exists $param{code} or not defined $param{code}) { + if (not exists $param{code} + or not defined $param{code} + or not length $param{code}) { error("There wasn't any R code supplied"); } my $code_result; @@ -66,7 +68,7 @@ sub preprocess { $code_result = $pagestate{$param{page}}{$id}{R}->run($param{code}); }; if ($@) { - error($@); + error("code '$param{code}' produced error '$@'"); } my $output = "sweave output\n\n"; if (exists $param{verbatim}) { -- 2.39.2