diff options
author | Björn Gustavsson <[email protected]> | 2017-02-21 13:15:30 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-02-21 13:30:22 +0100 |
commit | 57c1ecadd6e3ab6763b494e7a9509e67d0e6a661 (patch) | |
tree | ca4297f4b34defff02e9fdc6e4a24b706c50d681 /lib/asn1/src/asn1ct_imm.erl | |
parent | d5c350d57b92272b344a4aa29873ea9f7980ce7b (diff) | |
download | otp-57c1ecadd6e3ab6763b494e7a9509e67d0e6a661.tar.gz otp-57c1ecadd6e3ab6763b494e7a9509e67d0e6a661.tar.bz2 otp-57c1ecadd6e3ab6763b494e7a9509e67d0e6a661.zip |
PER decoding: Be less verbose for invalid ENUMERATED
When an invalid value is encountered when trying to decode an
ENUMERATED, the exception can be quite verbose. Here is an actual
example from NBAP-PDU-Contents:
_ -> exit({error,{asn1,{decode_enumerated,{V4@V3,[chCode1div1,chCode2div1,chCode2div2,chCode4div1,chCode4div2,chCode4div3,chCode4div4,chCode8div1,chCode8div2,chCode8div3,chCode8div4,chCode8div5,chCode8div6,chCode8div7,chCode8div8,chCode16div1,chCode16div2,chCode16div3,chCode16div4,chCode16div5,chCode16div6,chCode16div7,chCode16div8,chCode16div9,chCode16div10,chCode16div11,chCode16div12,chCode16div13,chCode16div14,chCode16div15,chCode16div16]}}}})
Listing the possible values for an ENUMERATED when decoding fails is
not helpful and increases the code size (it would have made somewhat
more sense to list the possible values if *encoding* failed).
Diffstat (limited to 'lib/asn1/src/asn1ct_imm.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_imm.erl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1ct_imm.erl b/lib/asn1/src/asn1ct_imm.erl index 754451b279..130f68c21d 100644 --- a/lib/asn1/src/asn1ct_imm.erl +++ b/lib/asn1/src/asn1ct_imm.erl @@ -879,10 +879,8 @@ flatten_map_cs_1([integer_default], {Int,_}) -> [{'_',Int}]; flatten_map_cs_1([enum_default], {Int,_}) -> [{'_',["{asn1_enum,",Int,"}"]}]; -flatten_map_cs_1([enum_error], {Var,Cs}) -> - Vs = [V || {_,V} <- Cs], - [{'_',["exit({error,{asn1,{decode_enumerated,{",Var,",", - {asis,Vs},"}}}})"]}]; +flatten_map_cs_1([enum_error], {Var,_}) -> + [{'_',["exit({error,{asn1,{decode_enumerated,",Var,"}}})"]}]; flatten_map_cs_1([], _) -> []. flatten_hoist_align([[{align_bits,_,_}=Ab|T]|Cs]) -> |