using System; using System.Runtime.Serialization; using Abp.Logging; namespace Abp.UI { /// /// This exception type is directly shown to the user. /// [Serializable] public class UserFriendlyException : AbpException, IHasLogSeverity, IHasErrorCode { /// /// Additional information about the exception. /// public string Details { get; private set; } /// /// An arbitrary error code. /// public int Code { get; set; } /// /// Severity of the exception. /// Default: Warn. /// public LogSeverity Severity { get; set; } /// /// Constructor. /// public UserFriendlyException() { Severity = LogSeverity.Warn; } /// /// Constructor for serializing. /// public UserFriendlyException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context) { } /// /// Constructor. /// /// Exception message public UserFriendlyException(string message) : base(message) { Severity = LogSeverity.Warn; } /// /// Constructor. /// /// Exception message /// Exception severity public UserFriendlyException(string message, LogSeverity severity) : base(message) { Severity = severity; } /// /// Constructor. /// /// Error code /// Exception message public UserFriendlyException(int code, string message) : this(message) { Code = code; } /// /// Constructor. /// /// Exception message /// Additional information about the exception public UserFriendlyException(string message, string details) : this(message) { Details = details; } /// /// Constructor. /// /// Error code /// Exception message /// Additional information about the exception public UserFriendlyException(int code, string message, string details) : this(message, details) { Code = code; } /// /// Constructor. /// /// Exception message /// Inner exception public UserFriendlyException(string message, Exception innerException) : base(message, innerException) { Severity = LogSeverity.Warn; } /// /// Constructor. /// /// Exception message /// Additional information about the exception /// Inner exception public UserFriendlyException(string message, string details, Exception innerException) : this(message, innerException) { Details = details; } } }