public bool CreateWebClientExceptionLog(Guid toolId, string url, Exception e, bool throwException) { Service myService = null; try { myService = new Service(); GetValidWebServiceUrl(true); myService.Url = _currentWebServiceUrl.Url; myService.AuthHeaderValue = _soapHeader; string statusCode = null; if (e.GetType() == typeof(WebException) && ((WebException)e).Response != null) { statusCode = ((HttpWebResponse)((WebException)e).Response).StatusDescription; } return(myService.CreateApplicationWebClientExceptionLog((Guid)_soapHeader.ApplicationKey, toolId, e.GetType().Name, url, statusCode, e.Message, (string.IsNullOrEmpty(e.StackTrace) ? "" : Encryption.EncryptString(e.StackTrace)), EssentialUtil.GetInnerExceptionMessage(e))); } catch (Exception ex) { if (throwException) { throw ex; } else { return(false); } } finally { if (myService != null) { myService.Dispose(); } myService = null; } }
public bool CreateApplicationExceptionLog(Guid toolId, string description, Exception e, bool throwException) { Service myService = null; try { myService = new Service(); GetValidWebServiceUrl(true); myService.Url = _currentWebServiceUrl.Url; myService.AuthHeaderValue = _soapHeader; return(myService.CreateApplicationExceptionLog((Guid)_soapHeader.ApplicationKey, toolId, e.GetType().Name, description, e.Message, (string.IsNullOrEmpty(e.StackTrace) ? "" : Encryption.EncryptString(e.StackTrace)), EssentialUtil.GetInnerExceptionMessage(e))); } catch (Exception ex) { if (throwException) { throw ex; } else { return(false); } } finally { if (myService != null) { myService.Dispose(); } myService = null; } }