| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Runtime.Serialization;
- using Abp.Logging;
- namespace Abp.UI
- {
- /// <summary>
- /// This exception type is directly shown to the user.
- /// </summary>
- [Serializable]
- public class UserFriendlyException : AbpException, IHasLogSeverity, IHasErrorCode
- {
- /// <summary>
- /// Additional information about the exception.
- /// </summary>
- public string Details { get; private set; }
- /// <summary>
- /// An arbitrary error code.
- /// </summary>
- public int Code { get; set; }
- /// <summary>
- /// Severity of the exception.
- /// Default: Warn.
- /// </summary>
- public LogSeverity Severity { get; set; }
- /// <summary>
- /// Constructor.
- /// </summary>
- public UserFriendlyException()
- {
- Severity = LogSeverity.Warn;
- }
- /// <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)
- {
- Severity = LogSeverity.Warn;
- }
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="message">Exception message</param>
- /// <param name="severity">Exception severity</param>
- public UserFriendlyException(string message, LogSeverity severity)
- : base(message)
- {
- Severity = severity;
- }
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="code">Error code</param>
- /// <param name="message">Exception message</param>
- public UserFriendlyException(int code, string message)
- : this(message)
- {
- Code = code;
- }
- /// <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="code">Error code</param>
- /// <param name="message">Exception message</param>
- /// <param name="details">Additional information about the exception</param>
- public UserFriendlyException(int code, string message, string details)
- : this(message, details)
- {
- Code = code;
- }
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="message">Exception message</param>
- /// <param name="innerException">Inner exception</param>
- public UserFriendlyException(string message, Exception innerException)
- : base(message, innerException)
- {
- Severity = LogSeverity.Warn;
- }
- /// <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;
- }
- }
- }
|