fix: try-case-of rather than try-of
try-of catches only what happens within but not after
This commit is contained in:
parent
965236c888
commit
b7e3f9d5a6
|
@ -266,11 +266,13 @@ code_change(_OldVsn, State, _Extra) ->
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
-define(PICK(ID, KEY, PID, EXPR),
|
-define(PICK(ID, KEY, PID, EXPR),
|
||||||
try gproc_pool:pick_worker(ID, KEY) of
|
try
|
||||||
PID when is_pid(PID) ->
|
case gproc_pool:pick_worker(ID, KEY) of
|
||||||
EXPR;
|
PID when is_pid(PID) ->
|
||||||
_ ->
|
EXPR;
|
||||||
?RESOURCE_ERROR(worker_not_created, "resource not created")
|
_ ->
|
||||||
|
?RESOURCE_ERROR(worker_not_created, "resource not created")
|
||||||
|
end
|
||||||
catch
|
catch
|
||||||
error:badarg ->
|
error:badarg ->
|
||||||
?RESOURCE_ERROR(worker_not_created, "resource not created");
|
?RESOURCE_ERROR(worker_not_created, "resource not created");
|
||||||
|
|
Loading…
Reference in New Issue