mirror of https://github.com/abpframework/abp.git
5 changed files with 53 additions and 126 deletions
@ -0,0 +1,9 @@ |
|||
namespace Volo.Abp.UI |
|||
{ |
|||
//TODO: Move to Volo.Abp namespace
|
|||
|
|||
public interface IUserFriendlyException |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace Volo.Abp.UI |
|||
{ |
|||
//TODO: Move to Volo.Abp namespace
|
|||
|
|||
/// <summary>
|
|||
/// This exception type is directly shown to the user.
|
|||
/// </summary>
|
|||
[Serializable] |
|||
public class UserFriendlyException : BusinessException, IUserFriendlyException |
|||
{ |
|||
public UserFriendlyException( |
|||
string message, |
|||
string code = null, |
|||
string details = null, |
|||
Exception innerException = null, |
|||
LogLevel logLevel = LogLevel.Warning) |
|||
: base( |
|||
code, |
|||
message, |
|||
details, |
|||
innerException, |
|||
logLevel) |
|||
{ |
|||
Details = details; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor for serializing.
|
|||
/// </summary>
|
|||
public UserFriendlyException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.UI |
|||
{ |
|||
//TODO: Remove IUserFriendlyException. Instead use IBusinessException.
|
|||
|
|||
[Obsolete("Use IBusinessException")] |
|||
public interface IUserFriendlyException |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -1,107 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
using Microsoft.Extensions.Logging; |
|||
using Volo.Abp.ExceptionHandling; |
|||
using Volo.Abp.Logging; |
|||
|
|||
namespace Volo.Abp.UI |
|||
{ |
|||
//TODO: Remove UserFriendlyException. Instead use BusinessException.
|
|||
|
|||
/// <summary>
|
|||
/// This exception type is directly shown to the user.
|
|||
/// </summary>
|
|||
[Serializable] |
|||
[Obsolete("Use BusinessException")] |
|||
public class UserFriendlyException : ApplicationException, |
|||
IUserFriendlyException, |
|||
IHasLogLevel, |
|||
IHasErrorCode, |
|||
IHasErrorDetails |
|||
{ |
|||
/// <summary>
|
|||
/// Additional information about the exception.
|
|||
/// </summary>
|
|||
public string Details { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// An arbitrary error code.
|
|||
/// </summary>
|
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Severity of the exception.
|
|||
/// Default: Warn.
|
|||
/// </summary>
|
|||
public LogLevel LogLevel { get; set; } = LogLevel.Warning; |
|||
|
|||
/// <summary>
|
|||
/// Constructor.
|
|||
/// </summary>
|
|||
public UserFriendlyException() |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor for serializing.
|
|||
/// </summary>
|
|||
public UserFriendlyException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor.
|
|||
/// </summary>
|
|||
/// <param name="message">Exception message</param>
|
|||
public UserFriendlyException(string message) |
|||
: base(message) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor.
|
|||
/// </summary>
|
|||
/// <param name="message">Exception message</param>
|
|||
/// <param name="logLevel">Exception severity</param>
|
|||
public UserFriendlyException(string message, LogLevel logLevel) |
|||
: base(message) |
|||
{ |
|||
LogLevel = logLevel; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor.
|
|||
/// </summary>
|
|||
/// <param name="message">Exception message</param>
|
|||
/// <param name="details">Additional information about the exception</param>
|
|||
public UserFriendlyException(string message, string details) |
|||
: this(message) |
|||
{ |
|||
Details = details; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor.
|
|||
/// </summary>
|
|||
/// <param name="message">Exception message</param>
|
|||
/// <param name="innerException">Inner exception</param>
|
|||
public UserFriendlyException(string message, Exception innerException) |
|||
: base(message, innerException) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Constructor.
|
|||
/// </summary>
|
|||
/// <param name="message">Exception message</param>
|
|||
/// <param name="details">Additional information about the exception</param>
|
|||
/// <param name="innerException">Inner exception</param>
|
|||
public UserFriendlyException(string message, string details, Exception innerException) |
|||
: this(message, innerException) |
|||
{ |
|||
Details = details; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue