aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlib/diameter/bin/diameterc4
-rw-r--r--lib/diameter/doc/src/diameter_make.xml18
-rw-r--r--lib/diameter/doc/src/seealso.ent3
-rw-r--r--lib/diameter/src/compiler/diameter_make.erl14
-rw-r--r--lib/diameter/test/diameter_compiler_SUITE.erl4
5 files changed, 33 insertions, 10 deletions
diff --git a/lib/diameter/bin/diameterc b/lib/diameter/bin/diameterc
index d31f341c36..2c9a8f555c 100755
--- a/lib/diameter/bin/diameterc
+++ b/lib/diameter/bin/diameterc
@@ -4,7 +4,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -74,7 +74,7 @@ compile(#argv{file = File, options = Opts, output = Out}) ->
ok ->
0;
{error, Reason} ->
- error_msg(Reason, []),
+ error_msg(diameter_make:format_error(Reason), []),
1
catch
error: Reason ->
diff --git a/lib/diameter/doc/src/diameter_make.xml b/lib/diameter/doc/src/diameter_make.xml
index 1c1eff6c6a..16ef49d4b2 100644
--- a/lib/diameter/doc/src/diameter_make.xml
+++ b/lib/diameter/doc/src/diameter_make.xml
@@ -16,7 +16,7 @@
<header>
<copyright>
<year>2012</year>
-<year>2013</year>
+<year>2014</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -175,6 +175,10 @@ Note that a dictionary's <c>&dict_name;</c>, together with the
The <c>&dict_name;</c> of a literal input dictionary defaults to
<c>dictionary</c>.</p>
+<p>
+A returned error reason can be converted into a readable string using
+&format_error;.</p>
+
</desc>
</func>
@@ -206,6 +210,18 @@ The return value is also a parsed dictionary.</p>
</desc>
</func>
+<!-- ===================================================================== -->
+
+<func>
+<name>format_error(Reason) -> string()</name>
+<fsummary>Turn an error reason into a readable string.</fsummary>
+<desc>
+
+<p>
+Turn an error reason returned by &codec; into a readable string.</p>
+</desc>
+</func>
+
</funcs>
<!-- ===================================================================== -->
diff --git a/lib/diameter/doc/src/seealso.ent b/lib/diameter/doc/src/seealso.ent
index 7bf7460351..44541afb9b 100644
--- a/lib/diameter/doc/src/seealso.ent
+++ b/lib/diameter/doc/src/seealso.ent
@@ -4,7 +4,7 @@
%CopyrightBegin%
-Copyright Ericsson AB 2012-2013. All Rights Reserved.
+Copyright Ericsson AB 2012-2014. All Rights Reserved.
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
@@ -117,6 +117,7 @@ significant.
<!ENTITY make_codec '<seealso marker="diameter_make#codec-2">diameter_make:codec/2</seealso>'>
<!ENTITY make_format '<seealso marker="diameter_make#format-1">diameter_make:format/1</seealso>'>
<!ENTITY make_flatten '<seealso marker="diameter_make#flatten-1">diameter_make:flatten/1</seealso>'>
+<!ENTITY make_format_error '<seealso marker="diameter_make#format_error-1">diameter_make:format_error/1</seealso>'>
<!-- diameter_transport -->
diff --git a/lib/diameter/src/compiler/diameter_make.erl b/lib/diameter/src/compiler/diameter_make.erl
index 2f314b7e57..adc7808e49 100644
--- a/lib/diameter/src/compiler/diameter_make.erl
+++ b/lib/diameter/src/compiler/diameter_make.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -33,7 +33,8 @@
-export([codec/2,
codec/1,
format/1,
- flatten/1]).
+ flatten/1,
+ format_error/1]).
-export_type([opt/0]).
@@ -81,8 +82,8 @@ codec(File, Opts) ->
case parse(Dict, Opts) of
{ok, ParseD} ->
make(Path, default(Opts), ParseD);
- {error = E, Reason} ->
- {E, diameter_dict_util:format_error(Reason)}
+ {error, _} = E ->
+ E
end.
codec(File) ->
@@ -115,6 +116,11 @@ flatten([?VERSION = V | Dict]) ->
[grouped, import_groups],
[enum, import_enums]])].
+%% format_error/1
+
+format_error(T) ->
+ diameter_dict_util:format_error(T).
+
%% ===========================================================================
%% flatten/2
diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl
index cc423d5bc6..0b053219cd 100644
--- a/lib/diameter/test/diameter_compiler_SUITE.erl
+++ b/lib/diameter/test/diameter_compiler_SUITE.erl
@@ -397,8 +397,8 @@ replace({E, Mods}, Bin) ->
case {E, parse(B, [{include, here()}]), Mods} of
{ok, {ok, Dict}, _} ->
Dict;
- {_, {error, S}, _} when E /= ok ->
- S
+ {_, {error, {E,_} = T}, _} when E /= ok ->
+ diameter_make:format_error(T)
end.
re({RE, Repl}, Bin) ->