47 lines
1.9 KiB
C#
Executable File
47 lines
1.9 KiB
C#
Executable File
using Opsoft.NetCore.O3App.Shared;
|
|
using System;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace Opsoft.NetCore.O3App.Domain
|
|
{
|
|
/// <summary>
|
|
/// O3App异常
|
|
/// </summary>
|
|
[Serializable]
|
|
public class O3AppException : Exception
|
|
{
|
|
public object Additional { get; set; }
|
|
public int StatusCode { get; }
|
|
public O3AppException() { }
|
|
public O3AppException(string message) : base(message) { }
|
|
public O3AppException(string message, Exception inner) : base(message, inner) { }
|
|
protected O3AppException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the O3AppException class with a specified StatusCode enum and a error message.
|
|
/// </summary>
|
|
public O3AppException(string message, int statusCode) : base(message)
|
|
{
|
|
StatusCode = statusCode;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the O3AppException class with a specified StatusCode enum and a error message and a reference to the inner exception that is the cause of this exception.
|
|
/// </summary>
|
|
public O3AppException(string message, int statusCode, Exception inner) : base(message, inner)
|
|
{
|
|
StatusCode = statusCode;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the O3AppException class with a specified StatusCode enum.
|
|
/// </summary>
|
|
public O3AppException(Enum @enum) : this(@enum.GetDesc(), @enum.ToInt32()) { }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the System.Exception class with a StatusCode eunm and a reference to the inner exception that is the cause of this exception.
|
|
/// </summary>
|
|
public O3AppException(Enum @enum, Exception inner) : this(@enum.GetDesc(), @enum.ToInt32(), inner) { }
|
|
}
|
|
}
|