aboutsummaryrefslogtreecommitdiff
path: root/src/xmpp_stream_in.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-06-25 09:45:45 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-06-25 09:45:45 +0300
commitac31c858669c33555aace5647c875caea4990ff9 (patch)
treed6d011b71ff9bb6f47d6d0a150bc6dae97b6fef0 /src/xmpp_stream_in.erl
parentGenerate SASL failures on unencrypted connections only for s2s (diff)
Use error formatting functions from xmpp library
Diffstat (limited to 'src/xmpp_stream_in.erl')
-rw-r--r--src/xmpp_stream_in.erl22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/xmpp_stream_in.erl b/src/xmpp_stream_in.erl
index 675425bd0..29e0d1016 100644
--- a/src/xmpp_stream_in.erl
+++ b/src/xmpp_stream_in.erl
@@ -196,10 +196,10 @@ format_error({socket, Reason}) ->
format("Connection failed: ~s", [format_inet_error(Reason)]);
format_error({stream, reset}) ->
<<"Stream reset by peer">>;
-format_error({stream, {in, #stream_error{reason = Reason, text = Txt}}}) ->
- format("Stream closed by peer: ~s", [format_stream_error(Reason, Txt)]);
-format_error({stream, {out, #stream_error{reason = Reason, text = Txt}}}) ->
- format("Stream closed by us: ~s", [format_stream_error(Reason, Txt)]);
+format_error({stream, {in, #stream_error{} = Err}}) ->
+ format("Stream closed by peer: ~s", [xmpp:format_stream_error(Err)]);
+format_error({stream, {out, #stream_error{} = Err}}) ->
+ format("Stream closed by us: ~s", [xmpp:format_stream_error(Err)]);
format_error({tls, Reason}) ->
format("TLS failed: ~s", [format_tls_error(Reason)]);
format_error(internal_failure) ->
@@ -1156,20 +1156,6 @@ format_inet_error(Reason) ->
Txt -> Txt
end.
--spec format_stream_error(atom() | 'see-other-host'(), [text()]) -> string().
-format_stream_error(Reason, Txt) ->
- Slogan = case Reason of
- undefined -> "no reason";
- #'see-other-host'{} -> "see-other-host";
- _ -> atom_to_list(Reason)
- end,
- case xmpp:get_text(Txt) of
- <<"">> ->
- Slogan;
- Data ->
- binary_to_list(Data) ++ " (" ++ Slogan ++ ")"
- end.
-
-spec format_sasl_error(cyrsasl:mechanism(), atom()) -> {atom(), binary()}.
format_sasl_error(<<"EXTERNAL">>, Err) ->
xmpp_stream_pkix:format_error(Err);