private static int LastCallError() { IErrorInfo errInfo = null; string sDesc = null; int res; if (GetErrorInfo(0, out errInfo) < 0 || errInfo == null) { return(-1); } try { if (errInfo.GetDescription(out sDesc) < 0 || sDesc == null) { return(-1); } } catch (System.Exception ex) { return(-2); } if (Int32.TryParse(sDesc, out res) == false) { return(-3); } return(res); }
public void OnError(IErrorInfo error) { if (error.Exception is JavaScriptException) { OnError((JavaScriptException)error.Exception); } }
public override void OnError(IErrorInfo error) { if (error.Exception is JavaScriptException exception) { OnError(exception); } }
/// <summary> /// Display an error. /// </summary> /// <param name="errorInfo"></param> void OnErrorOccurred(IErrorInfo errorInfo) { if (errorInfo.Behaviour == ErrorInfoBehavior.Alert) { m_View.AddAlert(k_ErrorOccuredId, AlertBox.AlertLevel.Alert, errorInfo.Message, (StringAssets.clear, m_Model.ClearError)); } }
/// <summary> /// Converts an <see cref="IErrorInfo"/> instance to an error info with a concrete type. /// </summary> /// <typeparam name="TErrorInfo">The concrete error info type.</typeparam> /// <param name="error">The <see cref="IErrorInfo"/> to convert</param> /// <returns>The converted error info.</returns> public static TErrorInfo ToErrorInfo <TErrorInfo>(this IErrorInfo error) where TErrorInfo : class, IErrorInfo, new() { return(error == null ? null : error as TErrorInfo ?? new TErrorInfo { Code = error.Code, Message = error.Message }); }
void SetWorstDesignError(IErrorInfo value) { if (_worstDesignError != value) { _worstDesignError = value; IsWorstErrorReadOnly = value == null || value.ErrorType == ErrorType.None || value.FixType == FixType.None || value.FixType == FixType.Delete; WorstError = value?.ErrorType ?? ErrorType.None; } }
public ActionableErrorInfo(IErrorInfo input, Action action) : this(action) { Message = input.Message; FixData = input.FixData; FixType = input.FixType; StackTrace = input.StackTrace; ErrorType = input.ErrorType; InstanceID = input.InstanceID; }
public ActionableErrorInfo(IErrorInfo input, Action action) : this(action) { Message = input.Message; FixData = input.FixData; FixType = input.FixType; StackTrace = input.StackTrace; ErrorType = input.ErrorType; InstanceID = input.InstanceID; }
public void RemoveError(IErrorInfo error) { var theError = Errors.FirstOrDefault(info => info.Equals(error)) ?? Errors.FirstOrDefault(info => info.ErrorType == error.ErrorType && info.FixType == error.FixType); if (theError != null) { _fixedErrors.Add(theError); _errors.Remove(theError); } }
/// <summary> /// Logs information from the specified <see cref="IErrorInfo"/> instance. /// </summary> /// <param name="logger">The logger to use.</param> /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to log to.</param> /// <param name="ex">The exception to log, if any.</param> public static void LogErrorInfo(this ILog logger, IErrorInfo errorInfo, Exception ex = null) { if (ex == null) { logger.Debug(errorInfo.ToErrorMessage()); } else { logger.Debug(errorInfo.ToErrorMessage(), ex); } }
bool KeepError(IErrorInfo reqiredMappingChanged) { bool keepError = false; if (reqiredMappingChanged.FixData != null) { keepError = KeepFixDataError(reqiredMappingChanged); } return(keepError); }
protected override void Validate(IErrorInfo errorInfo) { List<TextView> texts; if (_sourceBindingRelationships.TryGetValue(errorInfo.PropertyName, out texts)) { foreach (TextView editText in texts) { if (_firstText == null) _firstText = editText; editText.ErrorFormatted = Html.FromHtml(string.Format("<font color='black'>{0}</font>", errorInfo.Message)); } } }
bool KeepFixDataError(IErrorInfo reqiredMappingChanged) { bool keepError = false; var xElement = XElement.Parse(reqiredMappingChanged.FixData); var inputOutputViewModels = DeserializeMappings(true, xElement); foreach (var input in inputOutputViewModels) { keepError = KeepInputOutputViewModelError(input); } return(keepError); }
protected override void Validate(IErrorInfo errorInfo) { List<UIView> texts; if (_sourceBindingRelationships.TryGetValue(errorInfo.PropertyName, out texts)) { foreach (var editText in texts) { if (_firstText == null) _firstText = editText; editText.Layer.BorderColor = UIColor.Red.CGColor; editText.Layer.BorderWidth = 3.0f; } } }
/// <summary> /// Converts this <see cref="IErrorInfo"/> to an error message. /// </summary> /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to convert to an error message.</param> /// <param name="ex">The exception to include, if any.</param> public static string ToErrorMessage(this IErrorInfo errorInfo) { object error = $"Error {errorInfo.Code}"; if (Enum.IsDefined(typeof(EtpErrorCodes), errorInfo.Code)) { var value = (EtpErrorCodes)errorInfo.Code; FieldInfo fi = typeof(EtpErrorCodes).GetField(value.ToString()); DescriptionAttribute description = (DescriptionAttribute)fi.GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault(); error = description?.Description ?? error; } return($"{error}: {errorInfo.Message}"); }
protected override void Validate(IErrorInfo errorInfo) { if (_sourceBindingRelationships.TryGetValue(errorInfo.MemberName, out var texts)) { foreach (var editText in texts) { if (_firstText == null) { _firstText = editText; } editText.Layer.BorderColor = UIColor.Red.CGColor; editText.Layer.BorderWidth = 3.0f; } } }
protected override void Validate(IErrorInfo errorInfo) { List <TextView> texts; if (_sourceBindingRelationships.TryGetValue(errorInfo.MemberName, out texts)) { foreach (TextView editText in texts) { if (_firstText == null) { _firstText = editText; } editText.ErrorFormatted = Html.FromHtml(string.Format("<font color='black'>{0}</font>", errorInfo.Message)); } } }
public static IWbemClassObjectFreeThreaded GetErrorInfo() { IErrorInfo errorInfo = GetErrorInfo(0); if (errorInfo != null) { IntPtr ptr2; IntPtr iUnknownForObject = Marshal.GetIUnknownForObject(errorInfo); Marshal.QueryInterface(iUnknownForObject, ref IWbemClassObjectFreeThreaded.IID_IWbemClassObject, out ptr2); Marshal.Release(iUnknownForObject); if (ptr2 != IntPtr.Zero) { return(new IWbemClassObjectFreeThreaded(ptr2)); } } return(null); }
public void Handle(UpdateResourceMessage message) { if (message?.ResourceModel != null) { if (SourceId != Guid.Empty && SourceId == message.ResourceModel.ID) { IErrorInfo sourceNotAvailableMessage = ValidationMemoManager.DesignValidationErrors.FirstOrDefault(info => info.Message == ValidationMemoManager.SourceNotFoundMessage); if (sourceNotAvailableMessage != null) { ValidationMemoManager.RemoveError(sourceNotAvailableMessage); ValidationMemoManager.UpdateWorstError(); MappingManager.InitializeMappings(); MappingManager.UpdateMappings(); } } } }
public static void SetErrorDescription(string description, params object[] args) { ICreateErrorInfo errInfo; ErrorHandler.ThrowOnFailure(CreateErrorInfo(out errInfo)); errInfo.SetDescription(String.Format(description, args)); var guidNull = Guid.Empty; errInfo.SetGUID(ref guidNull); errInfo.SetHelpFile(null); errInfo.SetHelpContext(0); errInfo.SetSource(""); IErrorInfo errorInfo = errInfo as IErrorInfo; SetErrorInfo(0, errorInfo); }
public static IWbemClassObjectFreeThreaded GetErrorInfo() { IntPtr intPtr; IErrorInfo errorInfo = WbemErrorInfo.GetErrorInfo(0); if (errorInfo != null) { IntPtr unknownForObject = Marshal.GetIUnknownForObject(errorInfo); Marshal.QueryInterface(unknownForObject, ref IWbemClassObjectFreeThreaded.IID_IWbemClassObject, out intPtr); Marshal.Release(unknownForObject); if (intPtr != IntPtr.Zero) { return(new IWbemClassObjectFreeThreaded(intPtr)); } } return(null); }
public ErrorInfo(IErrorInfo info) { string description, helpFile, source; try { info.GetDescription(out description); //info.GetGUID(out guid); info.GetHelpFile(out helpFile); info.GetDescription(out source); Description = description; HelpFile = helpFile; Source = source; } catch (Exception) { Description = "Couldn't get error info, operation still in progress"; } }
public static IWbemClassObjectFreeThreaded GetErrorInfo() { IErrorInfo errorInfo = GetErrorInfo(0); if (null != errorInfo) { IntPtr pUnk = Marshal.GetIUnknownForObject(errorInfo); IntPtr pIWbemClassObject; Marshal.QueryInterface(pUnk, ref IWbemClassObjectFreeThreaded.IID_IWbemClassObject, out pIWbemClassObject); Marshal.Release(pUnk); // The IWbemClassObjectFreeThreaded instance will own reference count on pIWbemClassObject if (pIWbemClassObject != IntPtr.Zero) { return(new IWbemClassObjectFreeThreaded(pIWbemClassObject)); } } return(null); }
private void ProcessResult(int result) { if (result != 0) { IErrorInfo ppIErrorInfo = null; int res = NativeMethods.GetErrorInfo(0, out ppIErrorInfo); string pBstrDescription = string.Empty; if (ppIErrorInfo != null) { int res2 = ppIErrorInfo.GetDescription(out pBstrDescription); } string message = string.Format(CultureInfo.CurrentCulture, "Method returned an error. HRESULT = 0x{0:X8}", new object[] { result }); if (!String.IsNullOrEmpty(pBstrDescription)) { message = message + " : " + pBstrDescription; } throw new Exception(message); } }
public void Handle(UpdateResourceMessage message) { if (message != null && message.ResourceModel != null) { // if(message.ResourceModel.ID == ResourceID) // { // InitializeMappings(); // } if (SourceId != Guid.Empty && SourceId == message.ResourceModel.ID) { IErrorInfo sourceNotAvailableMessage = DesignValidationErrors.FirstOrDefault(info => info.Message == SourceNotFoundMessage); if (sourceNotAvailableMessage != null) { RemoveError(sourceNotAvailableMessage); UpdateWorstError(); InitializeMappings(); UpdateMappings(); } } } }
public void UpdateWorstError() { if (DesignValidationErrors.Count == 0) { DesignValidationErrors.Add(NoError); if (!_serviceDesignerViewModel.RootModel.HasErrors) { _serviceDesignerViewModel.RootModel.IsValid = true; } } IErrorInfo[] worstError = { DesignValidationErrors[0] }; foreach (var error in DesignValidationErrors.Where(error => error.ErrorType > worstError[0].ErrorType)) { worstError[0] = error; if (error.ErrorType == ErrorType.Critical) { break; } } WorstDesignError = worstError[0]; }
protected abstract void Validate(IErrorInfo errorInfo);
static extern int SetErrorInfo(uint dwReserved, IErrorInfo perrinfo);
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetErrorInfo( /* [in] */ ULONG ulRecordNum, /* [in] */ LCID lcid, /* [out] */ IErrorInfo **ppErrorInfo) = 0;
internal static extern System.Data.OleDb.OleDbHResult GetErrorInfo( [In] int dwReserved, [Out, MarshalAs(UnmanagedType.Interface)] out IErrorInfo ppIErrorInfo);
public void AddError(IErrorInfo error) { _errors.Add(error); }
public void AddError(IErrorInfo error) { }
static extern int SetErrorInfo(uint dwReserved, IErrorInfo perrinfo);
public override void OnError(IErrorInfo errorInfo) { base.OnError(errorInfo); }
public void AddError(IErrorInfo error) { _errors.Add(error); }
/// <summary> /// Initializes a new instance of the <see cref="CannotCreateDatabaseException"/> class. /// </summary> /// <param name="databaseName">Name of the database.</param> /// <param name="couchError">The error that CouchDB gave.</param> /// <param name="rawResponse">The raw response from the CouchDB server.</param> public CannotCreateDatabaseException(string databaseName, IErrorInfo couchError, IHttpResponse rawResponse) : base(String.Format(ExceptionMessageFormat, databaseName), couchError, rawResponse) { }
public void RemoveError(IErrorInfo error) { }
void RemoveError(IErrorInfo worstError) { DesignValidationErrors.Remove(worstError); RootModel.RemoveError(worstError); }
public static extern HRESULT GetErrorInfo(uint dwReserved, ref IErrorInfo pperrinfo);
public override void OnError(IErrorInfo error) { Server.SendAnnounce(error.Name + " has caused: " + error.Exception.Message); }
public void OnError(IErrorInfo errorInfo) { Console.WriteLine($"Error: {errorInfo.ErrorCode} -> {errorInfo.ErrorText}"); }
/// <summary> /// Initializes a new instance of the <see cref="CouchException"/> class. /// </summary> /// <param name="message">Message to use for the exception.</param> /// <param name="couchError">The error that CouchDB gave.</param> /// <param name="rawResponse">The raw response from the CouchDB server.</param> public CouchException(string message, IErrorInfo couchError, IHttpResponse rawResponse) : base(message) { CouchError = couchError; RawResponse = rawResponse; }
public void RemoveError(IErrorInfo error) { var theError = Errors.FirstOrDefault(info => info.Equals(error)) ?? Errors.FirstOrDefault(info => info.ErrorType == error.ErrorType && info.FixType == error.FixType); if (theError != null) { _fixedErrors.Add(theError); _errors.Remove(theError); } }
public void AddError(Expression<Func<Mock, object>> property, IErrorInfo error) { base.AddError(property, error); }