From d9e039164f2eb1dce7b37e24371d1be8d82b6c92 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Mon, 27 Dec 2010 14:56:05 +0100 Subject: Improved error handling for ssh:connect/3/4. --- lib/ssh/src/ssh.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/ssh/src') diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index b7f56b1b38..cada109df0 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -96,13 +96,17 @@ connect(Host, Port, Options, Timeout) -> do_demonitor(MRef, Manager), {error, Other}; {'DOWN', MRef, _, Manager, Reason} when is_pid(Manager) -> + error_logger:warning_report([{ssh, connect}, + {diagnose, + "Connection was closed before properly set up."}, + {host, Host}, + {port, Port}, + {reason, Reason}]), receive %% Clear EXIT message from queue - {'EXIT', Manager, _What} when Reason == normal -> - {error, channel_closed}; {'EXIT', Manager, _What} -> - {error, Reason} + {error, channel_closed} after 0 -> - {error, Reason} + {error, channel_closed} end after Timeout -> do_demonitor(MRef, Manager), -- cgit v1.2.3