[chronojump] Ping WebRequest.Create with try/catch for users with problems on proxy
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Ping WebRequest.Create with try/catch for users with problems on proxy
- Date: Wed, 30 Jan 2019 11:06:50 +0000 (UTC)
commit df66167efd8b7f2ae78b063a79ecfa5eab2993e0
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 30 12:05:41 2019 +0100
Ping WebRequest.Create with try/catch for users with problems on proxy
src/json.cs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/json.cs b/src/json.cs
index 9b00a5de..bd797965 100644
--- a/src/json.cs
+++ b/src/json.cs
@@ -219,7 +219,15 @@ public class Json
requestPingAborting = false;
// Create a request using a URL that can receive a post.
- requestPing = WebRequest.Create (serverUrl + "/ping");
+ try {
+ requestPing = WebRequest.Create (serverUrl + "/ping");
+ } catch {
+ this.ResultMessage =
+ string.Format(Catalog.GetString("You are not connected to the Internet\nor
{0} server is down."),
+ serverUrl) + "\n\nMaybe proxy is not configured";
+ //System.Net.WebRequest.GetSystemWebProxy System.NullReferenceException: Object
reference not set to an instance of an object
+ return false;
+ }
// Set the Method property of the request to POST.
requestPing.Method = "POST";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]