summaryrefslogtreecommitdiff
path: root/httemplate/misc/phonenums.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:59:20 -0700
commit75159fa6df40171b78d19c1edaeb15d815b0b68b (patch)
treeae8acfc896bec564f228a2df759b385ec67b569d /httemplate/misc/phonenums.cgi
parent6e2d51d0825c6dbb92fe7fb4c4e15868fdd6b611 (diff)
slightly better error reporting for DID selector, from #39914
Diffstat (limited to 'httemplate/misc/phonenums.cgi')
-rw-r--r--httemplate/misc/phonenums.cgi11
1 files changed, 8 insertions, 3 deletions
diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi
index 62923ac62..aae04f5d1 100644
--- a/httemplate/misc/phonenums.cgi
+++ b/httemplate/misc/phonenums.cgi
@@ -1,4 +1,4 @@
-<% encode_json(\@phonenums) %>\
+<% encode_json({ error => $error, phonenums => \@phonenums}) %>\
<%init>
my( $exchangestring, $svcpart ) = $cgi->param('arg');
@@ -7,6 +7,7 @@ my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
die "unknown svcpart $svcpart" unless $part_svc;
my @phonenums = ();
+my $error;
if ( $exchangestring ) {
@@ -35,8 +36,12 @@ if ( $exchangestring ) {
$opts{'exchange'} = $exchange;
}
- my $something = $export->get_dids(%opts);
- @phonenums = @{ $something };
+ local $@;
+ local $SIG{__DIE__};
+ my $something = eval { $export->get_dids(%opts) };
+ $error = $@;
+
+ @phonenums = @{ $something } if $something;
}