diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs | 57 |
1 files changed, 14 insertions, 43 deletions
diff --git a/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs b/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs index 4d68dbf59..ed2e69468 100644 --- a/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs +++ b/Software/Visual_Studio/Tango.Transport/Web/WebTransportClient.cs @@ -21,12 +21,6 @@ namespace Tango.Transport.Web public string AuthenticationToken { get; set; } - public TimeSpan RequestTimeout - { - get { return _httpClient.Timeout; } - set { _httpClient.Timeout = value; } - } - static WebTransportClient() { _settings = new JsonSerializerSettings() @@ -103,53 +97,30 @@ namespace Tango.Transport.Web } catch (HttpRequestException ex) { - bool handled = false; + String message = JObject.Parse(data).GetValue("Message").ToString(); + Exception exception = null; try { - String message = JObject.Parse(data).GetValue("Message").ToString(); - Exception exception = null; - - try + String exceptionMessage = JObject.Parse(data).GetValue("ExceptionMessage").ToString(); + String exceptionType = JObject.Parse(data).GetValue("ExceptionType").ToString(); + String stackTrace = JObject.Parse(data).GetValue("StackTrace").ToString(); + Type type = GetType(exceptionType); + if (type != null) { - String exceptionMessage = JObject.Parse(data).GetValue("ExceptionMessage").ToString(); - String exceptionType = JObject.Parse(data).GetValue("ExceptionType").ToString(); - String stackTrace = JObject.Parse(data).GetValue("StackTrace").ToString(); - Type type = GetType(exceptionType); - if (type != null) - { - exception = Activator.CreateInstance(type, new object[] { exceptionMessage + "\n" + stackTrace }) as Exception; - - } - else - { - exception = new HttpException(exceptionMessage + "\n" + stackTrace); - } + exception = Activator.CreateInstance(type, new object[] { exceptionMessage + "\n" + stackTrace }) as Exception; } - catch + else { - if (message == null) - { - Logging.LogManager.Default.Log($"Error parsing response message!\n{data}"); - } - - throw new HttpRequestException(ex.Message + " " + message); + exception = new HttpException(exceptionMessage + "\n" + stackTrace); } - - handled = true; - throw exception; } - catch (Exception handledException) + catch { - if (handled) - { - throw handledException; - } - else - { - throw ex; - } + throw new HttpRequestException(ex.Message + " " + message); } + + throw exception; } return JsonConvert.DeserializeObject<Response>(data); |
