コード例 #1
0
        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);
        }
コード例 #2
0
 public void OnError(IErrorInfo error)
 {
     if (error.Exception is JavaScriptException)
     {
         OnError((JavaScriptException)error.Exception);
     }
 }
コード例 #3
0
 public override void OnError(IErrorInfo error)
 {
     if (error.Exception is JavaScriptException exception)
     {
         OnError(exception);
     }
 }
コード例 #4
0
 /// <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));
     }
 }
コード例 #5
0
ファイル: CommonExtensions.cs プロジェクト: lanicon/etp.net
 /// <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
     });
 }
コード例 #6
0
 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;
     }
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 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;
 }
コード例 #9
0
ファイル: ResourceModel.cs プロジェクト: Spharah/Warewolf-ESB
        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);
            }
        }
コード例 #10
0
 /// <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);
     }
 }
コード例 #11
0
ファイル: MappingManager.cs プロジェクト: kapiya/Warewolf
        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));
         }
     }
 }
コード例 #13
0
ファイル: MappingManager.cs プロジェクト: kapiya/Warewolf
        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;
         }
     }
 }
コード例 #15
0
        /// <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));
                }
            }
        }
コード例 #18
0
        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);
        }
コード例 #19
0
 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();
             }
         }
     }
 }
コード例 #20
0
ファイル: NativeMethods.cs プロジェクト: yazici/PTVS
        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);
        }
コード例 #21
0
ファイル: WbemErrorInfo.cs プロジェクト: modulexcite/pash-1
        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);
        }
コード例 #22
0
ファイル: ErrorInfo.cs プロジェクト: voltagex/junkcode
        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";
            }
        }
コード例 #23
0
ファイル: wmiutil.cs プロジェクト: ash2005/z
        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);
        }
コード例 #24
0
 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);
     }
 }
コード例 #25
0
 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();
             }
         }
     }
 }
コード例 #26
0
        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);
コード例 #28
0
ファイル: NativeMethods.cs プロジェクト: yazici/PTVS
 static extern int SetErrorInfo(uint dwReserved, IErrorInfo perrinfo);
コード例 #29
0
 virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetErrorInfo(
     /* [in] */ ULONG ulRecordNum,
     /* [in] */ LCID lcid,
     /* [out] */ IErrorInfo **ppErrorInfo) = 0;
コード例 #30
0
 internal static extern System.Data.OleDb.OleDbHResult GetErrorInfo(
     [In] int dwReserved,
     [Out, MarshalAs(UnmanagedType.Interface)] out IErrorInfo ppIErrorInfo);
コード例 #31
0
ファイル: ResourceModel.cs プロジェクト: Robin--/Warewolf
 public void AddError(IErrorInfo error)
 {
     _errors.Add(error);
 }
コード例 #32
0
ファイル: TestResourceModel.cs プロジェクト: Robin--/Warewolf
 public void AddError(IErrorInfo error)
 {
 }
コード例 #33
0
 static extern int SetErrorInfo(uint dwReserved, IErrorInfo perrinfo);
コード例 #34
0
 public override void OnError(IErrorInfo errorInfo)
 {
     base.OnError(errorInfo);
 }
コード例 #35
0
ファイル: ResourceModel.cs プロジェクト: Spharah/Warewolf-ESB
 public void AddError(IErrorInfo error)
 {
     _errors.Add(error);
 }
コード例 #36
0
 /// <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)
 {
 }
コード例 #37
0
ファイル: TestResourceModel.cs プロジェクト: Robin--/Warewolf
 public void RemoveError(IErrorInfo error)
 {
 }
コード例 #38
0
 void RemoveError(IErrorInfo worstError)
 {
     DesignValidationErrors.Remove(worstError);
     RootModel.RemoveError(worstError);
 }
コード例 #39
0
 public static extern HRESULT GetErrorInfo(uint dwReserved, ref IErrorInfo pperrinfo);
コード例 #40
0
 public override void OnError(IErrorInfo error)
 {
     Server.SendAnnounce(error.Name + " has caused: " + error.Exception.Message);
 }
コード例 #41
0
 public void OnError(IErrorInfo errorInfo)
 {
     Console.WriteLine($"Error: {errorInfo.ErrorCode} -> {errorInfo.ErrorText}");
 }
コード例 #42
0
ファイル: CouchException.cs プロジェクト: jwalgran/ottoman
 /// <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;
 }
コード例 #43
0
ファイル: ResourceModel.cs プロジェクト: Robin--/Warewolf
 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);
 }