summaryrefslogtreecommitdiff
path: root/httemplate/misc/exchanges.cgi
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-03-28 17:36:25 -0700
committerMark Wells <mark@freeside.biz>2016-03-28 17:36:32 -0700
commit79dc2b72b17acaa6aa19da6cd4f8c1b8a194a794 (patch)
tree00ab2f4ac6ba11483435a645f2963ebacfa9dd35 /httemplate/misc/exchanges.cgi
parent11c9b2c65cc3c96ce86367ed1ca7e4bc24a4305d (diff)
slightly better error reporting for DID selector, from #39914
Diffstat (limited to 'httemplate/misc/exchanges.cgi')
-rw-r--r--httemplate/misc/exchanges.cgi11
1 files changed, 8 insertions, 3 deletions
diff --git a/httemplate/misc/exchanges.cgi b/httemplate/misc/exchanges.cgi
index 0de4ace25..d62679191 100644
--- a/httemplate/misc/exchanges.cgi
+++ b/httemplate/misc/exchanges.cgi
@@ -1,4 +1,4 @@
-<% encode_json(\@exchanges) %>\
+<% encode_json({ error => $error, exchanges => \@exchanges}) %>\
<%init>
my( $areacode, $svcpart ) = $cgi->param('arg');
@@ -7,6 +7,8 @@ my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
die "unknown svcpart $svcpart" unless $part_svc;
my @exchanges = ();
+my $error;
+
if ( $areacode ) {
my @exports = $part_svc->part_export_did;
@@ -17,9 +19,12 @@ if ( $areacode ) {
}
my $export = $exports[0];
- my $something = $export->get_dids('areacode'=>$areacode);
+ local $@;
+ local $SIG{__DIE__};
+ my $something = eval { $export->get_dids('areacode'=>$areacode) };
+ $error = $@;
- @exchanges = @{ $something };
+ @exchanges = @{ $something } if $something;
}