From 6f6d723898e186a54e0f407d5ff07bff2d3e21fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 30 Apr 2018 00:32:30 +0300 Subject: [PATCH] added todo for UserFriendlyException --- docs/Exception-Handling.md | 13 ++++++++++--- .../Volo/Abp/Ui/IUserFriendlyException.cs | 5 +++++ .../Volo/Abp/Ui/UserFriendlyException.cs | 8 ++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/Exception-Handling.md b/docs/Exception-Handling.md index 344447932a..32680c38f3 100644 --- a/docs/Exception-Handling.md +++ b/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 \ No newline at end of file +TODO + +### HTTP Status Code Mapping + +TODO \ No newline at end of file diff --git a/src/Volo.Abp.UI/Volo/Abp/Ui/IUserFriendlyException.cs b/src/Volo.Abp.UI/Volo/Abp/Ui/IUserFriendlyException.cs index 8b6b1fdc8d..25f14fb346 100644 --- a/src/Volo.Abp.UI/Volo/Abp/Ui/IUserFriendlyException.cs +++ b/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 { diff --git a/src/Volo.Abp.UI/Volo/Abp/Ui/UserFriendlyException.cs b/src/Volo.Abp.UI/Volo/Abp/Ui/UserFriendlyException.cs index 058f5cd441..96dcdd3fc0 100644 --- a/src/Volo.Abp.UI/Volo/Abp/Ui/UserFriendlyException.cs +++ b/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. + /// /// This exception type is directly shown to the user. /// [Serializable] + [Obsolete("Use BusinessException")] public class UserFriendlyException : ApplicationException, IUserFriendlyException, IHasLogLevel, @@ -30,14 +33,13 @@ namespace Volo.Abp.UI /// Severity of the exception. /// Default: Warn. /// - public LogLevel LogLevel { get; set; } + public LogLevel LogLevel { get; set; } = LogLevel.Warning; /// /// Constructor. /// public UserFriendlyException() { - LogLevel = LogLevel.Warning; } /// @@ -56,7 +58,6 @@ namespace Volo.Abp.UI public UserFriendlyException(string message) : base(message) { - LogLevel = LogLevel.Warning; } /// @@ -89,7 +90,6 @@ namespace Volo.Abp.UI public UserFriendlyException(string message, Exception innerException) : base(message, innerException) { - LogLevel = LogLevel.Warning; } ///