aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Whiteland <dave@fury.ukcod.org.uk>2011-04-14 09:15:38 +0100
committerDave Whiteland <dave@mysociety.org>2012-03-23 13:40:33 +0000
commite3a21eeaa41c492f6263c60dc46e1d63b8308134 (patch)
tree9a7014ee22c3167a2652f31083d61ec722a831e8
parent9b20b70888f43ea9e995e7df5d3c90cbca9ed9dc (diff)
changed from Error::try to eval, overcomes spurious run-time error with use strict
-rwxr-xr-xbin/send-reports14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 29980218c..93163ea08 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -22,6 +22,7 @@ use CronFns;
use FixMyStreet::App;
use EastHantsWSDL;
+use BarnetInterfaces::service::ZLBB_SERVICE_ORDER;
use Utils;
use mySociety::Config;
use mySociety::EmailUtil;
@@ -433,10 +434,11 @@ sub post_barnet_message {
my $interface = BarnetInterfaces::service::ZLBB_SERVICE_ORDER->new();
# note: config can be of form 'http://username@password:url' (or https, hopefully)
- if (my $barnet_endpoint = mySociety::Config::get('OPTION_BARNET_WEBSERVICE_ENDPOINT')) {
- $interface->set_proxy($barnet_endpoint) if $barnet_endpoint;
+ if (my $barnet_endpoint = mySociety::Config::get('OPTION_BARNET_WEBSERVICE_ENDPOINT', undef)) {
+ $interface->set_proxy($barnet_endpoint);
}
- try {
+
+ eval {
my $result = $interface->Z_CRM_SERVICE_ORDER_CREATE( {
ET_RETURN => { # ignored by server
item => {
@@ -467,7 +469,6 @@ sub post_barnet_message {
IV_PROBLEM_SUB => truncate_string_with_entities(ent(encode_utf8($h{title})), 40), # char40
},,
);
-
if ($result){
# currently not using this: get_EV_ORDER_GUID (maybe that's the customer number in the CRM)
if (my $barnet_id = $result->get_EV_ORDER_NO()) {
@@ -489,9 +490,10 @@ sub post_barnet_message {
print "Failed (problem id $h{id}): Fault $fault{code}$fault{actor}\n$fault{string}\n";
}
- } otherwise {
+ };
+ if ($@) {
my $e = shift;
- print "Caught an error: $e\n";
+ print "Caught an error: $@\n";
}
return $return;
}