erlang: Only handle throw() in pack/1 and unpack/1

Rationale: We only use throw/1 for error handling, never erlang:error/1.
           Caller bugs will get a nice {error,...} return while library bugs will
           bubble up in all their uglyness; that's the proper way to do things
           in erlang.
This commit is contained in:
Vincent de Phily 2010-07-09 20:37:06 +02:00
parent 02c882bda3
commit e944c1ee93

View file

@ -39,8 +39,6 @@ pack(Term)->
try
pack_(Term)
catch
error:Error when is_tuple(Error), element(1, Error) =:= error ->
Error;
throw:Exception ->
{error, Exception}
end.
@ -54,8 +52,6 @@ unpack(Bin) when is_binary(Bin) ->
try
unpack_(Bin)
catch
error:Error when is_tuple(Error), element(1, Error) =:= error ->
Error;
throw:Exception ->
{error, Exception}
end;