mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-06 17:59:52 +00:00
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:
parent
02c882bda3
commit
e944c1ee93
1 changed files with 0 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue