aboutsummaryrefslogtreecommitdiffstats
path: root/bin/send-reports
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2012-05-17 11:22:49 +0100
committerDave Whiteland <dave@mysociety.org>2012-05-17 11:22:49 +0100
commit40b3a51d33caefa8f5fb97ce9be18ef936c7e260 (patch)
tree59ede1e8e43738425202e62af451bc23f76ee5a2 /bin/send-reports
parentd0dfb6a70fcb7461e8f37197edb3f1deecbac9a0 (diff)
parent187068789666dee59ea286d5a0c7e2d0cee81173 (diff)
Merge branch 'fmb-read-only' of ssh://git.mysociety.org/data/git/public/fixmystreet into fmb-read-only
Diffstat (limited to 'bin/send-reports')
-rwxr-xr-xbin/send-reports17
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 1b29591da..c631f3a18 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -561,19 +561,28 @@ sub post_barnet_message {
$problem->external_body( 'Barnet Borough Council' ); # better to use $problem->body()?
$problem->send_method_used('barnet');
$return = 0;
- } else {
- $err_msg = "Failed (problem id $h{id}): service returned no external id";
+ } else {
+ my @returned_items = split /<item[^>]*>/, $result->get_ET_RETURN;
+ my @messages = ();
+ foreach my $item (@returned_items) {
+ if ($item=~/<MESSAGE [^>]*>\s*(\S.*?)<\/MESSAGE>/) { # if there's a non-null MESSAGE in there, grab it
+ push @messages, $1; # best stab at extracting useful error message back from convoluted response
+ }
+ }
+ push @messages, "service returned no external id" unless @messages;
+ $err_msg = "Failed (problem id $h{id}): " . join(" \n ", @messages);
}
} else {
my %fault = (
'code' => $result->get_faultcode(),
'actor' => $result->get_faultactor(),
'string' => $result->get_faultstring(),
- # 'detail' => $result->get_detail(), # possibly only contains debug info
+ 'detail' => $result->get_detail(), # possibly only contains debug info
);
$fault{$_}=~s/^\s*|\s*$//g foreach keys %fault;
$fault{actor}&&=" (actor: $fault{actor})";
- $err_msg = "Failed (problem id $h{id}): Fault $fault{code}$fault{actor}\n$fault{string}";
+ $fault{'detail'} &&= "\n" . $fault{'detail'};
+ $err_msg = "Failed (problem id $h{id}): Fault $fault{code}$fault{actor}\n$fault{string}$fault{detail}";
}
};