private async Task LogError(Exception ex) { try { Error error = new Error(); error.CreatedDate = DateTime.Now; error.Message = ex.Message; error.StackTrace = ex.StackTrace; _errorService.Create(error); await _errorService.SaveAsync(); } catch { } }
private void LogError(Exception ex) { try { Error error = new Error(); error.CreatedDate = DateTime.Now; error.Message = ex.Message; error.StackTrace = ex.StackTrace; _errorService.Create(error); _errorService.Save(); } catch { } }
private void LogError(Exception ex, string controllerName, string actionName) { try { Error error = new Error(); error.CreatedDate = DateTime.Now; error.Message = ex.Message + "in " + controllerName + "/" + actionName; error.StackTrace = ex.StackTrace; _errorService.Create(error); _errorService.Save(); } catch { } }
private void LogError(Exception ex) { try { Error _error = new Error() { Message = ex.Message, StackTrace = ex.StackTrace, DateCreated = DateTime.Now }; _errorService.Create(_error); _errorService.Save(); } catch { } }
private void LogError(Exception ex) { try { Error error = new Error(); error.Message = ex.Message; error.StackTrace = ex.StackTrace; error.CreatedDate = DateTime.Now; _errorService.Create(error); _errorService.Save(); } catch { Debug.WriteLine("Error on func LogError:" + ex.Message); } }
private void LogError(Exception ex) { try { Error error = new Error(); error.CreatedDate = DateTime.Now; error.Message = ex.Message; error.StackTrace = ex.StackTrace; _errorService.Create(error); _errorService.Save(); } catch (Exception e) { Console.WriteLine(e); throw; } }
private void LogError(Exception ex) { try { var error = new Error() { Message = ex.Message, StackTrace = ex.StackTrace, CreatedDate = DateTime.Now, CreatedBy = "log" }; _errorService.Create(error); _errorService.Save(); } catch { } }
private void LogError(Exception ex) { try { var error = new Error { CreatedDate = DateTime.Now, Message = ex.Message, StackTrace = ex.StackTrace }; ErrorService.Create(error); ErrorService.Save(); } catch (Exception exx) { Console.Write(exx); } }
private void LogError(Exception exception) { try { var error = new Error { Message = exception.Message, StackTrace = exception.StackTrace, CreatedDate = DateTime.Now }; _errorService.Create(error); _errorService.Save(); } catch (Exception) { } }
private String GenerateShortUrl(String url) { var shortUrl = url; try { var shortened = _bitlyService.Shorten(url); if (shortUrl != null) { shortUrl = shortened; } } catch (Exception exception) { _errorService.Create(exception.ToString()); } return(shortUrl); }
public async Task InvokeAsync(HttpContext httpContext, IErrorService errorService) { try { await _next(httpContext); } catch (Exception ex) { _logger.LogError($"Something went wrong: {ex}"); await errorService.Create(new VRCUdonAPI.Models.Entities.Error { ExceptionMessage = ex.Message, ExceptionSource = ex.Source, ExceptionType = ex.GetType().Name, ExceptionUrl = httpContext.Request.Path, InnerException = ex.InnerException, }); await HandleExceptionAsync(httpContext, ex); } }
public override void OnException(ExceptionContext filterContext) { try { if (filterContext != null && filterContext.Exception != null) { IErrorService errorService = ServiceLocator.Current.GetInstance <IErrorService>(); IUnitOfWork unitOfWork = ServiceLocator.Current.GetInstance <IUnitOfWork>(); if (errorService != null && unitOfWork != null) { errorService.Create(filterContext.Exception.ToString()); unitOfWork.Commit(); } } } catch { //TODO: In some cases we have to log exception to file. } // Redirect to page with error message. base.OnException(filterContext); }
public bool SendEmail(string receiverAddress, string receiverName, string subject, string body) { bool wasSended = false; using (SmtpClient smtpClient = new SmtpClient()) { smtpClient.Host = _settingService.SmtpServer; smtpClient.Port = _settingService.SmtpPort; if (!string.IsNullOrWhiteSpace(_settingService.SmtpLogin) && !string.IsNullOrWhiteSpace(_settingService.SmtpPassword)) { smtpClient.Credentials = new NetworkCredential(_settingService.SmtpLogin, _settingService.SmtpPassword); } using (var message = new MailMessage()) { try { message.IsBodyHtml = true; message.From = new MailAddress(_settingService.SmtpSenderAddress, _settingService.SmtpSenderName); message.To.Add(new MailAddress(receiverAddress, receiverName)); message.Body = body; message.Subject = subject; smtpClient.Send(message); wasSended = true; } catch (Exception exception) { _errorService.Create(exception.ToString()); } } } return(wasSended); }