using System; using System.Runtime.Serialization; namespace Znyc.Cloudcar.Admin.AspNetCore.Common { /// /// 自定义异常信息 /// public class MyApiException : Exception { /// /// 异常 /// /// public MyApiException(string message) { Msg = message; } /// /// /// /// public MyApiException(string message, string errcode) { Msg = message; ErrCode = errcode; } /// /// /// /// /// public MyApiException(string message, bool success, string errcode) { Msg = message; Success = success; ErrCode = errcode; } /// /// public MyApiException() { } /// /// /// /// protected MyApiException(SerializationInfo info, StreamingContext context) : base(info, context) { } /// /// /// /// public MyApiException(string message, Exception innerException) : base(message, innerException) { Msg = message; throw innerException; } /// /// /// /// /// public MyApiException(string message, string errcode, Exception innerException) : base(message, innerException) { Msg = message; ErrCode = errcode; throw innerException; } /// /// 异常消息 /// public string Msg { get; set; } /// /// 成功状态 /// public bool Success { get; set; } /// /// 提示代码 /// public string ErrCode { get; set; } } }