From e944c1ee93083a054f318e42a16eff699d9f066d Mon Sep 17 00:00:00 2001 From: Vincent de Phily Date: Fri, 9 Jul 2010 20:37:06 +0200 Subject: [PATCH] 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. --- erlang/msgpack.erl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erlang/msgpack.erl b/erlang/msgpack.erl index 0e7fb5d..f23ac87 100644 --- a/erlang/msgpack.erl +++ b/erlang/msgpack.erl @@ -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;