aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_config.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-02-11 00:04:37 +0100
committerAnders Svensson <[email protected]>2013-02-16 18:34:42 +0100
commitc9ca7f7e836dc6a4fe91fd4d7103af6d4db76f0e (patch)
treec9e26b79b00e5a6df5bd2567674dd8f7ffefcc91 /lib/diameter/src/base/diameter_config.erl
parentbbf692965470a9e993e1afd6f1a9375cbe832fcb (diff)
downloadotp-c9ca7f7e836dc6a4fe91fd4d7103af6d4db76f0e.tar.gz
otp-c9ca7f7e836dc6a4fe91fd4d7103af6d4db76f0e.tar.bz2
otp-c9ca7f7e836dc6a4fe91fd4d7103af6d4db76f0e.zip
Add application_opt() request_errors
Configuring the value 'callback' all errors detected in incoming requests to result in a handle_request callback. The default value 'answer_3xxx' is the previous behaviour in which diameter answers protocol errors without a callback.
Diffstat (limited to 'lib/diameter/src/base/diameter_config.erl')
-rw-r--r--lib/diameter/src/base/diameter_config.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl
index 1486071573..889c75e3da 100644
--- a/lib/diameter/src/base/diameter_config.erl
+++ b/lib/diameter/src/base/diameter_config.erl
@@ -672,13 +672,15 @@ app_acc({application, Opts}, Acc) ->
ModS = get_opt(state, Opts, Alias),
M = get_opt(call_mutates_state, Opts, false),
A = get_opt(answer_errors, Opts, report),
+ R = get_opt(request_errors, Opts, answer_3xxx),
[#diameter_app{alias = Alias,
dictionary = Dict,
id = cb(Dict, id),
module = init_mod(Mod),
init_state = ModS,
mutable = init_mutable(M),
- options = [{answer_errors, init_answers(A)}]}
+ options = [{answer_errors, init_answers(A)},
+ {request_errors, init_request_errors(R)}]}
| Acc];
app_acc(_, Acc) ->
Acc.
@@ -722,6 +724,13 @@ init_answers(A)
init_answers(A) ->
?THROW({answer_errors, A}).
+init_request_errors(P)
+ when callback == P;
+ answer_3xxx == P ->
+ P;
+init_request_errors(P) ->
+ ?THROW({request_errors, P}).
+
%% Get a single value at the specified key.
get_opt(Keys, List)
when is_list(Keys) ->