LP 1698176: Return undef with die event in Actor.pm _add_patron function. user/dyrcona/lp1698176_add_patron_die_event_fix
authorJason Stephenson <jason@sigio.com>
Thu, 15 Jun 2017 18:11:41 +0000 (14:11 -0400)
committerJason Stephenson <jason@sigio.com>
Tue, 29 Aug 2017 15:04:44 +0000 (11:04 -0400)
commit12cc30c74312cb447522dc46e96bc039f868bf47
treeef043f4ea814fc2f3f7e782306908fc7d5b011d4
parent8c7bdaa944117eb29cce47d5d23a842db1586596
LP 1698176: Return undef with die event in Actor.pm _add_patron function.

If the CStoreEditor create_actor_user call fails in the _add_patron
helper function in OpenILS/Application/Actor.pm, the CStorEditor's
die_event is returned as a scalar value.  The caller expects a list
return with two values: the user object in index 0 and the event, if
any, in index 1.

Returning just the event causes the caller to use the event as if it
were the user object.  This leads to a different error message later
in the code: Can't call method "billing_address" on unblessed
reference at /path/to/perlib/OpenILS/Application/Actor.pm line 743.

This commit changes the return value in the event of a database insert
failure to be the two member list as expected by the caller with undef
in index 0 and the die_event in index 1.  This returns the proper
error message to the client.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm