/// <summary> /// The add error. /// </summary> /// <param name="message"> /// The message. /// </param> /// <param name="title"></param> /// <param name="errorItems"></param> /// <param name="ex"> /// The ex. /// </param> /// <param name="viewModelType"></param> /// <param name="errors"></param> /// <returns> /// The <see cref="string"/>. /// </returns> public List <ViewModelError> AddError(string description, ViewModelError.ErrorAction action, ViewModelError.ErrorSeverity severity, string title = null, List <string> errorItems = null, Exception ex = null, string viewModelType = null, ReadOnlyDictionary <string, ReadOnlyCollection <string> > errors = null) { var error = new ViewModelError(title, description, action, severity, errorItems, ex, viewModelType, errors); _errors.Add(error); return(_errors); }
protected void HandleUIError(Exception ex, bool hideSpinner = true, ViewModelError.ErrorAction action = ViewModelError.ErrorAction.DisplayAndLog) { string title = null; if (hideSpinner) { AppSpinner.HideLoading(); } if (ex is HandledException exception && !exception.IsLog) { action = ViewModelError.ErrorAction.Display; } if (ex is HandledException exception2) { title = exception2.Title; } // hack: we just use this exception to surface messages to ui from any lib without including it if (ex is RankException) { action = ViewModelError.ErrorAction.Display; } AppErrorService.AddError(ex.Message, action, ViewModelError.ErrorSeverity.Error, title, ex: ex); AppErrorService.ProcessErrors(); }