X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fexchanges.cgi;h=d62679191339b83c532b1cb797ef9f640c46421f;hp=0de4ace25bffd50a383c37fb88970c6c109a7720;hb=ded6a5654efd56d2f271970c992133600e0223b1;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125 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; }