aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/eldap/src/eldap.erl22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl
index 699dfc8791..b3249d4f56 100644
--- a/lib/eldap/src/eldap.erl
+++ b/lib/eldap/src/eldap.erl
@@ -700,20 +700,22 @@ recv_response(S, Data) ->
Error -> throw(Error)
end;
{error,Reason} ->
- throw({gen_tcp_error, Reason});
- Error ->
- throw(Error)
+ throw({gen_tcp_error, Reason})
end.
%%% Sanity check of received packet
check_tag(Data) ->
- case asn1rt_ber_bin:decode_tag(l2b(Data)) of
- {_Tag, Data1, _Rb} ->
- case asn1rt_ber_bin:decode_length(l2b(Data1)) of
- {{_Len, _Data2}, _Rb2} -> ok;
- _ -> throw({error,decoded_tag_length})
- end;
- _ -> throw({error,decoded_tag})
+ try
+ {_Tag, Data1, _Rb} = asn1rt_ber_bin:decode_tag(l2b(Data)),
+ try
+ {{_Len, _Data2}, _Rb2} = asn1rt_ber_bin:decode_length(l2b(Data1)),
+ ok
+ catch
+ _ -> throw({error,decoded_tag_length})
+ end
+ catch
+ _ ->
+ throw({error, decoded_tag})
end.
%%% Check for expected kind of reply