forked from JamesRandall/FunctionMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved template and added error handling for Cosmos
- Loading branch information
1 parent
e076e5e
commit f95e267
Showing
20 changed files
with
322 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Samples/Scratch/SwaggerBuildOut/ExampleCosmosErrorHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using FunctionMonkey.Commanding.Cosmos.Abstractions; | ||
using Microsoft.Azure.Documents; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace SwaggerBuildOut | ||
{ | ||
public class ExampleCosmosErrorHandler : ICosmosDbErrorHandler | ||
{ | ||
private readonly ILogger<ExampleCosmosErrorHandler> _logger; | ||
|
||
public ExampleCosmosErrorHandler(ILogger<ExampleCosmosErrorHandler> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public Task<bool> HandleError(Exception ex, Document document) | ||
{ | ||
_logger.LogError(ex, "Went wrong"); | ||
return Task.FromResult(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Source/FunctionMonkey.Abstractions/ICosmosDbErrorHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Documents; | ||
|
||
namespace FunctionMonkey.Commanding.Cosmos.Abstractions | ||
{ | ||
/// <summary> | ||
/// Implementations of this handle Cosmos errors at the Function level. | ||
/// </summary> | ||
public interface ICosmosDbErrorHandler | ||
{ | ||
/// <summary> | ||
/// Handle a error processing a Cosmos document. | ||
/// To abort processing of the current batch return false. | ||
/// </summary> | ||
/// <param name="ex">The exception that caused the error</param> | ||
/// <param name="document">The document that caused the error</param> | ||
/// <returns>True to continue processing, false to stop processing of the batch</returns> | ||
Task<bool> HandleError(Exception ex, Document document); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.