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.
* `BusinessException`: Indicates a business exception (rather than infrastructure exceptions). You can instead implement the `IBusinessException` interface.
* `UserFriendlyException`: Indicates an exception that can be **directly shown to the user** (without hiding or localizing). You can instead implement the `IUserFriendlyException` interface.
#### Business Exception
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
@ -135,4 +138,8 @@ You can also throw these type of exceptions in your code (while it's rarely need
### 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
{
//TODO: Remove IUserFriendlyException. Instead use IBusinessException.
[Obsolete("Use IBusinessException")]
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
{
//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,
@ -30,14 +33,13 @@ namespace Volo.Abp.UI
/// Severity of the exception.
/// Default: Warn.
/// </summary>
public LogLevel LogLevel { get; set; }
public LogLevel LogLevel { get; set; } = LogLevel.Warning;
/// <summary>
/// Constructor.
/// </summary>
public UserFriendlyException()
{
LogLevel = LogLevel.Warning;
}
/// <summary>
@ -56,7 +58,6 @@ namespace Volo.Abp.UI
public UserFriendlyException(string message)
: base(message)
{
LogLevel = LogLevel.Warning;
}
/// <summary>
@ -89,7 +90,6 @@ namespace Volo.Abp.UI
public UserFriendlyException(string message, Exception innerException)
: base(message, innerException)
{
LogLevel = LogLevel.Warning;
}
/// <summary>

Loading…
Cancel
Save