paulcbetts/ModernHttpClient — pull request #49 by guillaume-fr (2014-04-07 08:04:08+00:00)
Title: handle connection failure (timeout,...)

04-07 03:52:34.684 I/MonoDroid( 2011): UNHANDLED EXCEPTION: Java.Net.ConnectException: Exception of type 'Java.Net.ConnectException' was thrown.
04-07 03:52:34.684 I/MonoDroid( 2011): at Android.Runtime.JNIEnv.CallIntMethod (IntPtr jobject, IntPtr jmethod) [0x00000] in :0
04-07 03:52:34.684 I/MonoDroid( 2011): at Java.Net.HttpURLConnection.get_ResponseCode () [0x00000] in :0
04-07 03:52:34.684 I/MonoDroid( 2011): at ModernHttpClient.OkHttpNetworkHandler+c__async0+c__AnonStorey8.<>m__1 () [0x00020] in /Users/paul/code/paulcbetts/ModernHttpClient/src/ModernHttpClient.Android/OkHttpNetworkHandler.cs:55
04-07 03:52:34.684 I/MonoDroid( 2011): at System.Threading.Tasks.TaskActionInvoker+FuncInvoke`1[System.Net.Http.HttpResponseMessage].Invoke (System.Threading.Tasks.Task owner, System.Object state, System.Threading.Tasks.Task context) [0x00000] in :0
04-07 03:52:34.684 I/04-07 03:52:34.684 I/MonoDroid( 2011): at System.Threading.Tasks.Task.InnerInvoke () [0x00000] in :0
04-07 03:52:34.684 I/MonoDroid( 2011): at System.Threading.Tasks.Task.ThreadStart () [0x00000] in :0
04-07 03:52:34.684 I/MonoDroid( 2011): --- End of stack trace from previous location where exception was thrown ---
04-07 03:52:34.684 I/MonoDroid( 2011): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0
04-07 03:52:34.684 I/MonoDroid( 2011): at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in :0
04-07 03:52:34.684 I/MonoDroid( 2011): at ModernHttpClient.OkHttpNetworkHandler+c__async0.MoveNext () [0x002a8] in /Users/paul/code/paulcbetts/ModernHttpClient/src/ModernHttpClient.Android/OkHttpNetworkHandler.cs:50
04-07 03:52:34.684 I/MonoDroid( 2011): --- End of stack trace from previous location where exception was thrown ---

libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)

Other ideas
- Catching IOException could be safier
- Extract more information from java's exception to give a more specific message and status