Skip to content

Commit 46d127f

Browse files
authoredAug 5, 2022
chore: Modify namespace (#174)
1 parent 4908727 commit 46d127f

10 files changed

+40
-11
lines changed
 

‎src/Utils/Masa.Utils.Exceptions/Extensions/ApplicationBuilderExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
using Masa.Utils.Exceptions.Handlers;
5-
64
namespace Microsoft.AspNetCore.Builder;
75

86
public static class ApplicationBuilderExtensions

‎src/Utils/Masa.Utils.Exceptions/Handlers/ExceptionHandlerMiddleware.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
namespace Masa.Utils.Exceptions.Handlers;
4+
namespace Microsoft.AspNetCore.Builder;
55

66
public class ExceptionHandlerMiddleware
77
{
@@ -20,7 +20,10 @@ public ExceptionHandlerMiddleware(
2020
{
2121
_next = next;
2222
_options = options.Value;
23-
_masaExceptionHandler = ExceptionHandlerExtensions.GetMasaExceptionHandler(serviceProvider, _options.MasaExceptionHandlerType);
23+
_masaExceptionHandler =
24+
Masa.Utils.Exceptions.Internal.ExceptionHandlerExtensions.GetMasaExceptionHandler(
25+
serviceProvider,
26+
_options.MasaExceptionHandlerType);
2427
_logRelationOptions = logRelationOptions.Value;
2528
_logger = logger;
2629
}

‎src/Utils/Masa.Utils.Exceptions/Handlers/ExceptionHandlingMiddleware.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
namespace Masa.Utils.Exceptions.Handlers;
4+
namespace Microsoft.AspNetCore.Builder;
55

66
public class ExceptionHandlingMiddleware
77
{

‎src/Utils/Masa.Utils.Exceptions/Handlers/GlobalExceptionFilter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
namespace Masa.Utils.Exceptions.Handlers;
4+
namespace Microsoft.AspNetCore.Mvc.Filters;
55

66
/// <summary>
77
/// Mvc pipeline exception filter to catch global exception

‎src/Utils/Masa.Utils.Exceptions/IMasaExceptionHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
namespace Masa.Utils.Exceptions;
4+
namespace System;
55

66
public interface IMasaExceptionHandler
77
{

‎src/Utils/Masa.Utils.Exceptions/MasaException.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ public class MasaException : Exception
77
{
88
public string? ErrorCode { get; set; }
99

10+
public object[] Parameters { get; set; }
11+
1012
public MasaException()
1113
{
1214
}
@@ -16,7 +18,19 @@ public MasaException(string message)
1618
{
1719
}
1820

19-
public MasaException(string message, Exception innerException)
21+
public MasaException(string errorCode, params object[] parameters)
22+
: this(null, errorCode, parameters)
23+
{
24+
}
25+
26+
public MasaException(Exception? innerException, string errorCode, params object[] parameters)
27+
: base(null, innerException)
28+
{
29+
ErrorCode = errorCode;
30+
Parameters = parameters;
31+
}
32+
33+
public MasaException(string message, Exception? innerException)
2034
: base(message, innerException)
2135
{
2236
}

‎src/Utils/Masa.Utils.Exceptions/Options/MasaExceptionHandlerOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
namespace Masa.Utils.Exceptions;
4+
namespace System;
55

66
public class MasaExceptionHandlerOptions
77
{

‎src/Utils/Masa.Utils.Exceptions/Options/MasaExceptionHandlingOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4-
namespace Masa.Utils.Exceptions;
4+
namespace System;
55

66
public class MasaExceptionHandlingOptions
77
{

‎src/Utils/Masa.Utils.Exceptions/UserFriendlyException.cs

+15
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,19 @@ public UserFriendlyException(string message)
99
: base(message)
1010
{
1111
}
12+
13+
public UserFriendlyException(string message, Exception? innerException)
14+
: base(message, innerException)
15+
{
16+
}
17+
18+
public UserFriendlyException(string errorCode, params object[] parameters)
19+
: base(errorCode, parameters)
20+
{
21+
}
22+
23+
public UserFriendlyException(Exception? innerException, string errorCode, params object[] parameters)
24+
: base(innerException, errorCode, parameters)
25+
{
26+
}
1227
}

‎src/Utils/Masa.Utils.Exceptions/_Imports.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

44
global using Masa.Utils.Exceptions;
5-
global using Masa.Utils.Exceptions.Handlers;
65
global using Masa.Utils.Exceptions.Internal;
76
global using Microsoft.AspNetCore.Http;
87
global using Microsoft.AspNetCore.Mvc;

0 commit comments

Comments
 (0)
Please sign in to comment.