Skip to content

Commit d72bb03

Browse files
author
IharYakimush
authored
Merge pull request #3 from IharYakimush/develop
v2.0.3
2 parents a880f44 + f6aa064 commit d72bb03

File tree

7 files changed

+28
-22
lines changed

7 files changed

+28
-22
lines changed

Community.AspNetCore.ExceptionHandling.Integration/Community.AspNetCore.ExceptionHandling.Integration.csproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp2.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<Folder Include="wwwroot\" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.2" />
1312
<PackageReference Include="Microsoft.AspNetCore.Buffering" Version="0.2.2" />
13+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.1.1" />
14+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.1" />
15+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.1.1" />
1416
</ItemGroup>
1517

1618
<ItemGroup>

Community.AspNetCore.ExceptionHandling.Integration/Controllers/ValuesController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Community.AspNetCore.ExceptionHandling.Integration.Controllers
77
{
88
[Route("api/[controller]")]
9-
public class ValuesController : Controller
9+
public class ValuesController : ControllerBase
1010
{
1111
// GET api/values
1212
[HttpGet]

Community.AspNetCore.ExceptionHandling.Integration/Startup.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Startup(IConfiguration configuration)
2121
// This method gets called by the runtime. Use this method to add services to the container.
2222
public void ConfigureServices(IServiceCollection services)
2323
{
24-
services.AddMvc();
24+
services.AddMvcCore().AddJsonFormatters();
2525

2626
services.AddExceptionHandlingPolicies(options =>
2727
{
@@ -55,7 +55,7 @@ public void ConfigureServices(IServiceCollection services)
5555
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
5656
{
5757
//app.UseResponseBuffering();
58-
app.UseDeveloperExceptionPage().UseExceptionHandlingPolicies();
58+
app.UseExceptionHandlingPolicies();
5959
app.UseMvc();
6060
}
6161
}

Community.AspNetCore.ExceptionHandling.Mvc/Community.AspNetCore.ExceptionHandling.Mvc.csproj

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55
<Description>Extension methods to configure exception handler which write MVC action result to responce body. Userfull for writing objects</Description>
66
<PackageProjectUrl>https://github.com/IharYakimush/asp-net-core-exception-handling</PackageProjectUrl>
77
<PackageLicenseUrl>https://github.com/IharYakimush/asp-net-core-exception-handling/blob/develop/LICENSE</PackageLicenseUrl>
88
<Copyright>IharYakimush</Copyright>
99
<PackageTags>aspnetcore exception handling policy mvc action result</PackageTags>
10-
<AssemblyVersion>2.0.2.0</AssemblyVersion>
10+
<AssemblyVersion>2.0.3.0</AssemblyVersion>
1111
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1212
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
13-
<FileVersion>2.0.2.0</FileVersion>
13+
<FileVersion>2.0.3.0</FileVersion>
1414
<Company />
1515
<Authors>IharYakimush</Authors>
16-
<Version>2.0.2</Version>
16+
<Version>2.0.3</Version>
1717
<SignAssembly>true</SignAssembly>
1818
<AssemblyOriginatorKeyFile>..\sgn.snk</AssemblyOriginatorKeyFile>
1919
<ApplicationIcon />
2020
<OutputType>Library</OutputType>
2121
<StartupObject />
22+
<PackageReleaseNotes>target netstandard2.0 only</PackageReleaseNotes>
2223
</PropertyGroup>
2324

2425
<ItemGroup>
26+
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.2" />
2527
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.1.1" />
2628
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.1" />
2729
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="2.1.1" />

Community.AspNetCore.ExceptionHandling.NewtonsoftJson/Community.AspNetCore.ExceptionHandling.NewtonsoftJson.csproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
<PackageLicenseUrl>https://github.com/IharYakimush/asp-net-core-exception-handling/blob/develop/LICENSE</PackageLicenseUrl>
99
<PackageProjectUrl>https://github.com/IharYakimush/asp-net-core-exception-handling</PackageProjectUrl>
1010
<PackageTags>aspnetcore exception handling policy json response</PackageTags>
11-
<AssemblyVersion>2.0.2.0</AssemblyVersion>
12-
<Version>2.0.2</Version>
11+
<AssemblyVersion>2.0.3.0</AssemblyVersion>
12+
<Version>2.0.3</Version>
1313
<Company />
1414
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1515
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
16+
<PackageReleaseNotes>target netstandard2.0 only</PackageReleaseNotes>
17+
<FileVersion>2.0.3.0</FileVersion>
1618
</PropertyGroup>
1719

1820
<ItemGroup>

Community.AspNetCore.ExceptionHandling/Community.AspNetCore.ExceptionHandling.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netcoreapp2.1</TargetFrameworks>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55
<Description>Middleware to configure exception handling policies. Configure chain of handlers per exception type. OOTB handlers: log, retry, set responce headers and body</Description>
66
<PackageProjectUrl>https://github.com/IharYakimush/asp-net-core-exception-handling</PackageProjectUrl>
77
<PackageLicenseUrl>https://github.com/IharYakimush/asp-net-core-exception-handling/blob/develop/LICENSE</PackageLicenseUrl>
88
<Copyright>IharYakimush</Copyright>
99
<PackageTags>aspnetcore exception handling policy</PackageTags>
10-
<AssemblyVersion>2.0.2.0</AssemblyVersion>
10+
<AssemblyVersion>2.0.3.0</AssemblyVersion>
1111
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1212
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
13-
<FileVersion>2.0.2.0</FileVersion>
13+
<FileVersion>2.0.3.0</FileVersion>
1414
<Company />
1515
<Authors>IharYakimush</Authors>
16-
<Version>2.0.2</Version>
16+
<Version>2.0.3</Version>
1717
<SignAssembly>true</SignAssembly>
1818
<AssemblyOriginatorKeyFile>..\sgn.snk</AssemblyOriginatorKeyFile>
1919
<ApplicationIcon />
2020
<OutputType>Library</OutputType>
2121
<StartupObject />
22-
<PackageReleaseNotes>WithBody method changed to use Stream instead of StreamWriter to unify behaviour in case of buffered and chunked responses</PackageReleaseNotes>
22+
<PackageReleaseNotes>target netstandard2.0 only</PackageReleaseNotes>
2323
</PropertyGroup>
2424

2525
<PropertyGroup Condition="'$(Configuration)'=='Debug'">

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void ConfigureServices(IServiceCollection services)
3030
lo.EventIdFactory = (c, e) => new EventId(123, "UnhandlerException");
3131
lo.Category = (context, exception) => "MyCategory";
3232
})
33-
.Response(e => 500, ResponseAlreadyStartedBehaviour.GoToNextHandler)
33+
.Response(null, ResponseAlreadyStartedBehaviour.GoToNextHandler)
3434
.ClearCacheHeaders()
3535
.WithObjectResult((r, e) => new { msg = e.Message, path = r.Path })
3636
.Handled();
@@ -62,8 +62,8 @@ Sample of transitions:
6262
![alt text](/Transitions.png)
6363

6464
### Nuget
65-
| Package | Target | Comments |
66-
| ---------| ------------- | ------------- |
67-
| Community.AspNetCore.ExceptionHandling | netstandard2.0 netcoreapp2.1 | Main functionality |
68-
| Community.AspNetCore.ExceptionHandling.Mvc | netcoreapp2.1 | Alllow to use MVC IActionResult (including ObjectResult) in 'Response' handler |
69-
| Community.AspNetCore.ExceptionHandling.NewtonsoftJson | netstandard2.0 | Allow to set Json serialized object as a response body in 'Response' handler. Use it only if 'Community.AspNetCore.ExceptionHandling.Mvc' usage not possible |
65+
| Package | Comments |
66+
| ---------| ------------- |
67+
| Community.AspNetCore.ExceptionHandling | Main functionality |
68+
| Community.AspNetCore.ExceptionHandling.Mvc | Allow to use MVC IActionResult (including ObjectResult) in 'Response' handler |
69+
| Community.AspNetCore.ExceptionHandling.NewtonsoftJson | Allow to set Json serialized object as a response body in 'Response' handler. Use it only if 'Community.AspNetCore.ExceptionHandling.Mvc' usage not possible |

0 commit comments

Comments
 (0)