Skip to content

Commit

Permalink
Merge pull request #58 from siisltd/feature/cancellation_exception_ha…
Browse files Browse the repository at this point in the history
…ndling

Cancellation exception handling
  • Loading branch information
Markeli authored Dec 5, 2023
2 parents edcc69e + 634d55f commit 2183e96
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Misc/Curiosity.Tools.Web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.3.1]

### Added

- Cancellation exception handling, write a message to WARN log

## [1.3.0] - 2023-11-28

### Changed
Expand Down
6 changes: 6 additions & 0 deletions src/Misc/Curiosity.Tools.Web/Controllers/MVCBaseController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Curiosity.Tools.Web.Resources;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Diagnostics;
Expand Down Expand Up @@ -83,6 +84,11 @@ public ActionResult ErrorView(
message = ex.Message;
logger.LogWarning(ex, $"Connection was closed by the client while sending response: {ex.Message}.");
break;
case TaskCanceledException _:
case OperationCanceledException _:
message = ex.Message;
logger.LogWarning(ex, "Request was canceled by user");
break;
default:
logger.LogError(ex, $"Unhandled error: {ex.Message}");
break;
Expand Down
2 changes: 1 addition & 1 deletion src/Misc/Curiosity.Tools.Web/Curiosity.Tools.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<PackageVersion>1.3.0</PackageVersion>
<PackageVersion>1.3.1</PackageVersion>

<Authors>Max Markelow (@markeli), Andrei Vinogradov (@anri-vin), Andrey Ioch (@DevCorvette)</Authors>
<Company>SIIS Ltd</Company>
Expand Down

0 comments on commit 2183e96

Please sign in to comment.