aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2014-11-27 12:50:37 +0100
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:28 +0100
commit411f2d2c42ab86872186c0ea015f2e76a84c30ab (patch)
treefef104f5d7c3109f9f9ff057539a7d134d12ad59 /lib/asn1/src
parent0c2cb3cba7d8adee96453cf2be008a3edca25c8b (diff)
downloadotp-411f2d2c42ab86872186c0ea015f2e76a84c30ab.tar.gz
otp-411f2d2c42ab86872186c0ea015f2e76a84c30ab.tar.bz2
otp-411f2d2c42ab86872186c0ea015f2e76a84c30ab.zip
asn1: Fix error reporting for the EXTERNAL type
Change to new error handling system and cover with tests.
Diffstat (limited to 'lib/asn1/src')
-rw-r--r--lib/asn1/src/asn1ct_check.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl
index 5c1113c865..68b1a499e3 100644
--- a/lib/asn1/src/asn1ct_check.erl
+++ b/lib/asn1/src/asn1ct_check.erl
@@ -2013,7 +2013,7 @@ to_EXTERNAL1990(S, [{#seqtag{val=identification}=T,
to_EXTERNAL1990(S, Rest, [{T#seqtag{val='indirect-reference'},PCid},
{T#seqtag{val='direct-reference'},TrStx}]);
to_EXTERNAL1990(S, _) ->
- error({value,"illegal value in EXTERNAL type",S}).
+ asn1_error(S, illegal_external_value).
to_EXTERNAL1990(S, [V={#seqtag{val='data-value-descriptor'},_}|Rest], Acc) ->
to_EXTERNAL1990(S, Rest, [V|Acc]);
@@ -2021,7 +2021,7 @@ to_EXTERNAL1990(_S, [{#seqtag{val='data-value'}=T,Val}], Acc) ->
Encoding = {T#seqtag{val=encoding},{'CHOICE',{'octet-aligned',Val}}},
lists:reverse([Encoding|Acc]);
to_EXTERNAL1990(S, _, _) ->
- error({value,"illegal value in EXTERNAL type",S}).
+ asn1_error(S, illegal_external_value).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Functions to normalize the default values of SEQUENCE
@@ -5933,6 +5933,8 @@ format_error(illegal_bitstring_value) ->
"expecting a BIT STRING value";
format_error({illegal_class_name,Class}) ->
io_lib:format("the class name '~s' is illegal (it must start with an uppercase letter and only contain uppercase letters, digits, or hyphens)", [Class]);
+format_error(illegal_external_value) ->
+ "illegal value in EXTERNAL type";
format_error({illegal_instance_of,Class}) ->
io_lib:format("using INSTANCE OF on class '~s' is illegal, "
"because INSTANCE OF may only be used on the class TYPE-IDENTIFIER",