[freeside-devel] Error handling from _custoragent_session_custnum

ivan ivan at 420.am
Mon Jul 11 02:51:01 PDT 2005


applied, thanks!  please use unified diff format (diff -u) in the 
future.

-- 
_ivan


On Thu, Jul 07, 2005 at 09:47:11AM -0700, Randall Lucas wrote:
> I have been getting some "Unknown custnum " errors in integrating my new
> code with our existing FS install.  In tracking this down, I've been
> reading ClientAPI/MyAccount.pm and am puzzled by this error checking idiom:
> 
>   my($context, $session, $custnum) = _custoragent_session_custnum($p);
>   return { 'error' => $session } if $context eq 'error';
> 
> (found in e.g. order_pkg, unprovision_svc and elsewhere.)
> 
> Upon error, _custoragent_session_custnum returns a hashref, while it
> normally returns a three-element array.  I believe this is just curly
> braces where parens are needed.
> 
> I'm attaching a patch.
> 
> 

> Index: MyAccount.pm
> ===================================================================
> RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
> retrieving revision 1.36
> diff -r1.36 MyAccount.pm
> 781c781
> <       or return { 'error' => "Can't resume session" }; #better error message
> ---
> >       or return ( 'error' => "Can't resume session" ); #better error message
> 791c791
> <       or return { 'error' => "Can't resume session" }; #better error message
> ---
> >       or return ( 'error' => "Can't resume session" ); #better error message
> 795c795
> <     return { 'error' => "Can't resume session" }; #better error message
> ---
> >     return ( 'error' => "Can't resume session" ); #better error message



More information about the freeside-devel mailing list