• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ErrorCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ErrorCode的典型用法代码示例。如果您正苦于以下问题:C# ErrorCode类的具体用法?C# ErrorCode怎么用?C# ErrorCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ErrorCode类属于命名空间,在下文中一共展示了ErrorCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AjaxRedirect

 public virtual ActionResult AjaxRedirect(ErrorCode result, string successUrl, string failUrl = "")
 {
     AjaxStatusCode status = result == ErrorCode.NoError ? AjaxStatusCode.Success : AjaxStatusCode.Error;
     string targetAction = result == ErrorCode.NoError ? successUrl : failUrl;
     string message = EnumHelper.GetDescription(result);
     return MyAjaxHelper.RedirectAjax(status, message, null, targetAction);
 }
开发者ID:jesusblessf6,项目名称:Maike,代码行数:7,代码来源:BaseController.cs


示例2: CheckForStaticClass

 // Generate an error if CType is static.
 public bool CheckForStaticClass(Symbol symCtx, CType CType, ErrorCode err)
 {
     if (!CType.isStaticClass())
         return false;
     ReportStaticClassError(symCtx, CType, err);
     return true;
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:SemanticChecker.cs


示例3: CheckError

		public static ErrorCode CheckError (ErrorCode error)
		{
			if (IsError (error))
				throw ErrorException (error);
			
			return error;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:7,代码来源:ErrorCodes.cs


示例4: GetSeverity

 internal static DiagnosticSeverity GetSeverity(ErrorCode code)
 {
     if (code == ErrorCode.Void)
     {
         return InternalDiagnosticSeverity.Void;
     }
     else if (code == ErrorCode.Unknown)
     {
         return InternalDiagnosticSeverity.Unknown;
     }
     else if (IsWarning(code))
     {
         return DiagnosticSeverity.Warning;
     }
     else if (IsInfo(code))
     {
         return DiagnosticSeverity.Info;
     }
     else if (IsHidden(code))
     {
         return DiagnosticSeverity.Hidden;
     }
     else
     {
         return DiagnosticSeverity.Error;
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:27,代码来源:ErrorFacts.cs


示例5: UsbError

        internal UsbError(ErrorCode errorCode, int win32ErrorNumber, string win32ErrorString, string description, object sender)
        {
            mSender = sender;
            string senderText = String.Empty;
            if ((mSender is UsbEndpointBase)|| (mSender is UsbTransfer))
            {
                UsbEndpointBase ep;
                if (mSender is UsbTransfer)
                    ep = ((UsbTransfer)mSender).EndpointBase;
                else
                    ep = mSender as UsbEndpointBase;

                if (ep.mEpNum != 0)
                {

                    senderText = senderText+=string.Format(" Ep 0x{0:X2} ", ep.mEpNum);
                }
            }
            else if (mSender is Type)
            {
                Type t = mSender as Type;
                senderText = senderText += string.Format(" {0} ", t.Name);
            }
            mErrorCode = errorCode;
            mWin32ErrorNumber = win32ErrorNumber;
            mWin32ErrorString = win32ErrorString;
            mDescription = description + senderText;
        }
开发者ID:arvydas,项目名称:BlinkStickDotNet,代码行数:28,代码来源:UsbDevice.Error.cs


示例6: ThrowOnFailure

        internal static void ThrowOnFailure(ErrorCode errorCode)
        {
            if (errorCode >= 0)
                return;

            switch (errorCode)
            {
            case ErrorCode.OutOfHostMemory:
                throw new OutOfMemoryException("Could not allocate OpenCL resources on the host.");

            case ErrorCode.OutOfResources:
                throw new OutOfMemoryException("Could not allocate OpenCL resources on the device.");

            case ErrorCode.DevicePartitionFailed:
                throw new InvalidOperationException("The device could not be further partitioned.");

            case ErrorCode.InvalidDevicePartitionCount:
                throw new InvalidOperationException("Invalid device partition size.");

            case ErrorCode.InvalidCommandQueue:
                throw new ArgumentException("Invalid command queue.");

            case ErrorCode.InvalidEventWaitList:
                throw new ArgumentException("The event wait list contained an invalid event.");

            case ErrorCode.InvalidDevice:
                throw new ArgumentException("Invalid device.");

            case ErrorCode.InvalidValue:
                throw new ArgumentException("Invalid value.");

            default:
                throw new Exception(string.Format("Unknown error code: {0}", errorCode));
            }
        }
开发者ID:JamesLinus,项目名称:Asm4GCN,代码行数:35,代码来源:ErrorHandler.cs


示例7: FormatMessage

        private static string FormatMessage(ErrorCode errorCode, string info)
        {
            switch (errorCode)
            {
                case ErrorCode.TooManyWarnings:
                    info = string.Format("There are more than {0} warnings", CodeGeneratorWarnings.MaximumWarningCount);
                    break;

                case ErrorCode.InvalidIncludeTemplateFormat:
                    info = "Include placeholders must have the following format: $NAME$(filename)";
                    break;

                case ErrorCode.InvalidIncludeTemplateFormatOpeningBracket:
                    info = string.Format("{0} is missing \"(\"", info);
                    break;

                case ErrorCode.InvalidIncludeTemplateFormatClosingBracket:
                    info = string.Format("{0} is missing \")\"", info);
                    break;
            }

            if (info == null || info == string.Empty)
                info = "No Info"; // should not occur

            return string.Format("OBLXE{0:d4}: {1}: {2}", (int)errorCode, errorCode.ToString(), info);
        }
开发者ID:re-motion,项目名称:Web-CodeGenerator,代码行数:26,代码来源:CodeGeneratorException.cs


示例8: TransformToOptionObject_CustomOptionObjectWithProperties_PropertyValuesAreEqual

 public void TransformToOptionObject_CustomOptionObjectWithProperties_PropertyValuesAreEqual(ErrorCode errorCode)
 {
     var transform = InitTransform();
     var customOptionObject = MockBasicCustomOptionObject();
     customOptionObject.ErrorCode = errorCode;
     var result = transform.TransformToOptionObject(customOptionObject);
     var expected = new object[]
     {
         customOptionObject.EntityID,
         customOptionObject.EpisodeNumber,
         (double)customOptionObject.ErrorCode,
         customOptionObject.ErrorMesg,
         customOptionObject.Facility,
         customOptionObject.OptionId,
         customOptionObject.OptionStaffId,
         customOptionObject.OptionUserId,
         customOptionObject.SystemCode
     };
     var actual = new object[]
     {
         result.EntityID,
         result.EpisodeNumber,
         result.ErrorCode,
         result.ErrorMesg,
         result.Facility,
         result.OptionId,
         result.OptionStaffId,
         result.OptionUserId,
         result.SystemCode
     };
     CollectionAssert.AreEqual(expected, actual);
 }
开发者ID:RickIsWright,项目名称:scriptlink-core,代码行数:32,代码来源:CustomOptionObjectTransformTests.cs


示例9: JabberException

 public JabberException(ErrorCode errorCode)
     : base()
 {
     StreamError = false;
     CloseStream = false;
     this.ErrorCode = errorCode;
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:7,代码来源:JabberException.cs


示例10: Add

 /// <summary>
 /// Add a diagnostic to the bag.
 /// </summary>
 /// <param name="diagnostics"></param>
 /// <param name="code"></param>
 /// <param name="location"></param>
 /// <param name="args"></param>
 /// <returns></returns>
 internal static CSDiagnosticInfo Add(this DiagnosticBag diagnostics, ErrorCode code, Location location, params object[] args)
 {
     var info = new CSDiagnosticInfo(code, args);
     var diag = new CSDiagnostic(info, location);
     diagnostics.Add(diag);
     return info;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:15,代码来源:DiagnosticBagExtensions.cs


示例11: GetResponseMessage

        public GetResponseMessage(int requestId, VersionCode version, OctetString community, ErrorCode error, int index, IList<Variable> variables)
        {
            if (variables == null)
            {
                throw new ArgumentNullException("variables");
            }
            
            if (community == null)
            {
                throw new ArgumentNullException("community");
            }
            
            if (version == VersionCode.V3)
            {
                throw new ArgumentException("Please use overload constructor for v3", "version");
            }

            Version = version;
            Header = Header.Empty;
            Parameters = new SecurityParameters(null, null, null, community, null, null);
            GetResponsePdu pdu = new GetResponsePdu(
                requestId,
                error,
                index,
                variables);
            Scope = new Scope(pdu);
            Privacy = DefaultPrivacyProvider.DefaultPair;

            _bytes = SnmpMessageExtension.PackMessage(Version, Header, Parameters, Scope, Privacy).ToBytes();
        }
开发者ID:moljac,项目名称:MonoMobile.SharpSNMP,代码行数:30,代码来源:GetResponseMessage.cs


示例12: BaseException

 public BaseException(ErrorCode errorNumber, string errorMsg, Exception innerError)
     : base(errorMsg, innerError)
 {
     this.mTime = DateTime.Now;
     this.errorNumber = errorNumber;
     this.errorMsg = errorMsg + (innerError == null ? string.Empty : ": " + innerError.Message);
 }
开发者ID:khoainv,项目名称:Framework,代码行数:7,代码来源:BaseException.cs


示例13: ProtocolException

 /// <summary>
 /// Initializes a new instance of the <see cref="ProtocolException"/> class.
 /// </summary>
 /// <param name="protocolVersion">The CQL binary protocol version in use.</param>
 /// <param name="code">The code.</param>
 /// <param name="message">The message.</param>
 /// <param name="tracingId">The tracing identifier.</param>
 internal ProtocolException(byte protocolVersion, ErrorCode code, string message, Guid? tracingId)
     : base(code + ": " + message)
 {
     Code = code;
     ProtocolVersion = protocolVersion;
     TracingId = tracingId;
 }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:14,代码来源:ProtocolException.cs


示例14: Status

 public Status(MessageHeader header, ErrorSeverity errorSeverity, ErrorCode errorCode, string description)
     : base(header, CommandType.Status)
 {
     Severity = errorSeverity;
     Code = errorCode;
     Description = description;
 }
开发者ID:Caraul,项目名称:FabricAdcHub,代码行数:7,代码来源:Status.cs


示例15: ReportError

		public override void ReportError(ErrorCode errorCode, string message, string file, int lineNumber)
		{
            if(errorCode == ErrorCode.Assertion || errorCode == ErrorCode.InternalError || errorCode == ErrorCode.OutOfMemory )
                ActiveLogger.LogMessage("PhysX: " + message, LogLevel.FatalError);
            else
                ActiveLogger.LogMessage("PhysX: " + message, LogLevel.RecoverableError);
		}
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:7,代码来源:UserOutput.cs


示例16: CompilerMessage

 internal CompilerMessage(ErrorCode errorCode, string message, int lineNumber, string scriptName)
 {
     _message = message;
     _errorCode = errorCode;
     _lineNumber = lineNumber;
     _scriptName = scriptName ?? string.Empty;
 }
开发者ID:smarinel,项目名称:ags-web,代码行数:7,代码来源:CompilerMessage.cs


示例17: GlobalizationError

        /// <summary>
        /// Constructor setting error code
        /// </summary>
        public GlobalizationError(ErrorCode error)
        {
            this.Code = error;

            switch (error)
            {
                case ErrorCode.ParsingError:
                    {
                        this.Message = ParsingError;
                        break;
                    }
                case ErrorCode.FormattingError:
                    {
                        this.Message = FormattingError;
                        break;
                    }
                case ErrorCode.PatternError:
                    {
                        this.Message = PatternError;
                        break;
                    }
                default:
                    {
                        this.Message = UnknownError;
                        break;
                    }
            }
        }
开发者ID:CN-Onboarding,项目名称:Cerner-Onboarding,代码行数:31,代码来源:GlobalizationApiTypes.cs


示例18:

 public string this[ErrorCode index]
 {
     get
     {
         return ErrorStore[index];
     }
 }
开发者ID:ladome,项目名称:Confidami,代码行数:7,代码来源:ErrorCodeStore.cs


示例19: GetResponse

 public virtual OperationResponse GetResponse(ErrorCode errorCode, string debugMessage = "")
 {
     var response = new OperationResponse(OperationRequest.OperationCode);
     response.ReturnCode = (short) errorCode;
     response.DebugMessage = debugMessage;
     return response;
 }
开发者ID:nPaul,项目名称:TestPhotonLib,代码行数:7,代码来源:BaseOperation.cs


示例20: IsError

 ///<summary>Returns whether this SqlException was caused by the given ErrorCode (A SQL Server error number)</summary>
 public static bool IsError(this SqlException sqlEx, ErrorCode error)
 {
     var code = sqlEx.Number;
     bool isErrorCode = Enum.IsDefined(typeof(ErrorCode), code);
     if (!isErrorCode) logger.Info(m => m("Code {0} undefined", code));
     return isErrorCode && (ErrorCode)code == error;
 }
开发者ID:DanStout,项目名称:ExtensionLib,代码行数:8,代码来源:SqlExceptionExtensions.cs



注:本文中的ErrorCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ErrorCodes类代码示例发布时间:2022-05-24
下一篇:
C# ErrorCategory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap