Browse Source

added todo for UserFriendlyException

pull/279/head
Halil İbrahim Kalkan 8 years ago
parent
commit
6f6d723898
  1. 13
      docs/Exception-Handling.md
  2. 5
      src/Volo.Abp.UI/Volo/Abp/Ui/IUserFriendlyException.cs
  3. 8
      src/Volo.Abp.UI/Volo/Abp/Ui/UserFriendlyException.cs

13
docs/Exception-Handling.md

@ -120,8 +120,11 @@ public class MyException : Exception, IExceptionWithSelfLogging
There are some **conventional** exception classes you can **directly throw** or **derive** your own exception types when needed. There are some **conventional** exception classes you can **directly throw** or **derive** your own exception types when needed.
* `BusinessException`: Indicates a business exception (rather than infrastructure exceptions). You can instead implement the `IBusinessException` interface. #### Business Exception
* `UserFriendlyException`: Indicates an exception that can be **directly shown to the user** (without hiding or localizing). You can instead implement the `IUserFriendlyException` interface.
Most of your own exceptions will be business exceptions. The `IBusinessException` interface is used to mark an exception as a business exception.
`BusinessException` implements the `IBusinessException` interface in addition to the `IHasErrorCode`, `IHasErrorDetails` and `IHasLogLevel` interfaces. Default log level is `Warning`.
### Built-In Exceptions ### Built-In Exceptions
@ -135,4 +138,8 @@ You can also throw these type of exceptions in your code (while it's rarely need
### Exception Localization ### Exception Localization
### HTTP Status Code Mapping TODO
### HTTP Status Code Mapping
TODO

5
src/Volo.Abp.UI/Volo/Abp/Ui/IUserFriendlyException.cs

@ -1,5 +1,10 @@
using System;
namespace Volo.Abp.UI namespace Volo.Abp.UI
{ {
//TODO: Remove IUserFriendlyException. Instead use IBusinessException.
[Obsolete("Use IBusinessException")]
public interface IUserFriendlyException public interface IUserFriendlyException
{ {

8
src/Volo.Abp.UI/Volo/Abp/Ui/UserFriendlyException.cs

@ -6,10 +6,13 @@ using Volo.Abp.Logging;
namespace Volo.Abp.UI namespace Volo.Abp.UI
{ {
//TODO: Remove UserFriendlyException. Instead use BusinessException.
/// <summary> /// <summary>
/// This exception type is directly shown to the user. /// This exception type is directly shown to the user.
/// </summary> /// </summary>
[Serializable] [Serializable]
[Obsolete("Use BusinessException")]
public class UserFriendlyException : ApplicationException, public class UserFriendlyException : ApplicationException,
IUserFriendlyException, IUserFriendlyException,
IHasLogLevel, IHasLogLevel,
@ -30,14 +33,13 @@ namespace Volo.Abp.UI
/// Severity of the exception. /// Severity of the exception.
/// Default: Warn. /// Default: Warn.
/// </summary> /// </summary>
public LogLevel LogLevel { get; set; } public LogLevel LogLevel { get; set; } = LogLevel.Warning;
/// <summary> /// <summary>
/// Constructor. /// Constructor.
/// </summary> /// </summary>
public UserFriendlyException() public UserFriendlyException()
{ {
LogLevel = LogLevel.Warning;
} }
/// <summary> /// <summary>
@ -56,7 +58,6 @@ namespace Volo.Abp.UI
public UserFriendlyException(string message) public UserFriendlyException(string message)
: base(message) : base(message)
{ {
LogLevel = LogLevel.Warning;
} }
/// <summary> /// <summary>
@ -89,7 +90,6 @@ namespace Volo.Abp.UI
public UserFriendlyException(string message, Exception innerException) public UserFriendlyException(string message, Exception innerException)
: base(message, innerException) : base(message, innerException)
{ {
LogLevel = LogLevel.Warning;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save