diff options
author | Dan Gudmundsson <[email protected]> | 2014-12-01 13:22:47 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-01-12 11:40:29 +0100 |
commit | e9b758a50a648e4d0a54963a6530a4b3cb3f68ce (patch) | |
tree | 85b9d994d7a475d63981c03329622269a14cd7ff /lib/asn1 | |
parent | 80d35f40a69215cc1a2c883941a7b137a90db725 (diff) | |
download | otp-e9b758a50a648e4d0a54963a6530a4b3cb3f68ce.tar.gz otp-e9b758a50a648e4d0a54963a6530a4b3cb3f68ce.tar.bz2 otp-e9b758a50a648e4d0a54963a6530a4b3cb3f68ce.zip |
Modernize error handling for named values
Diffstat (limited to 'lib/asn1')
-rw-r--r-- | lib/asn1/src/asn1ct_check.erl | 15 | ||||
-rw-r--r-- | lib/asn1/test/error_SUITE.erl | 5 |
2 files changed, 7 insertions, 13 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index 19ecd78069..208b4eb180 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -4019,7 +4019,7 @@ update_state(S,ModuleName) -> get_renamed_reference(S,Name,Module) -> case renamed_reference(S,Name,Module) of undefined -> - throw({error,{asn1,{undefined_type,Name}}}); + asn1_error(S, {undefined, Name}); NewTypeName when NewTypeName =/= Name -> get_referenced1(S,Module,NewTypeName,undefined) end. @@ -4179,8 +4179,8 @@ check_named_number_list(S, NNL0) -> asn1_error(S, {namelist_redefinition,H}) end. -resolve_valueref(S, #'Externalvaluereference'{module=Mod,value=Name}) -> - dbget_ex(S, Mod, Name); +resolve_valueref(S, #'Externalvaluereference'{} = T) -> + get_referenced_value(S, T); resolve_valueref(_, Val) when is_integer(Val) -> Val. @@ -5731,15 +5731,6 @@ get_taglist1(_S,[]) -> %% tag_number('CHARACTER STRING') -> 29; %% tag_number('BMPString') -> 30. - -dbget_ex(_S,Module,Key) -> - case asn1_db:dbget(Module,Key) of - undefined -> - - throw({error,{asn1,{undefined,{Module,Key}}}}); % this is catched on toplevel type or value - T -> T - end. - merge_tags(T1, T2) when is_list(T2) -> merge_tags2(T1 ++ T2, []); merge_tags(T1, T2) -> diff --git a/lib/asn1/test/error_SUITE.erl b/lib/asn1/test/error_SUITE.erl index ca3f9f55e9..d41134e5cb 100644 --- a/lib/asn1/test/error_SUITE.erl +++ b/lib/asn1/test/error_SUITE.erl @@ -258,11 +258,14 @@ integers(Config) -> " Int1 ::= INTEGER {a(1), a(1)}\n" " Int2 ::= INTEGER {a(1), b(2), a(3)}\n" " Int3 ::= INTEGER {x(1), y(1)}\n" + " i0 INTEGER ::= 1\n" + " Int4 ::= INTEGER {x(i0), y(undef) }\n" "END\n">>}, {error, [{structured_error,{M,2},asn1ct_check,{namelist_redefinition,a}}, {structured_error,{M,3},asn1ct_check,{namelist_redefinition,a}}, - {structured_error,{M,4},asn1ct_check,{value_reused,1}} + {structured_error,{M,4},asn1ct_check,{value_reused,1}}, + {structured_error,{M,6},asn1ct_check,{undefined,undef}} ]} = run(P, Config), ok. |