-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathErrorHandling.cs
More file actions
39 lines (33 loc) · 1.13 KB
/
Copy pathErrorHandling.cs
File metadata and controls
39 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// This file is referenced by docs/core/event_handler/appsync_events.md
// via pymdownx.snippets (mkdocs).
namespace AWS.Lambda.Powertools.Docs.Snippets.AppSyncEvents;
// --8<-- [start:error_handling_individual]
app.OnPublish("/default/channel", (payload) =>
{
throw new Exception("My custom exception");
});
// --8<-- [end:error_handling_individual]
// --8<-- [start:error_handling_individual_async]
app.OnPublishAsync("/default/channel", async (payload) =>
{
throw new Exception("My custom exception");
});
// --8<-- [end:error_handling_individual_async]
// --8<-- [start:error_handling_batch]
app.OnPublishAggregate("/default/channel", (payload) =>
{
throw new Exception("My custom exception");
});
// --8<-- [end:error_handling_batch]
// --8<-- [start:error_handling_batch_async]
app.OnPublishAggregateAsync("/default/channel", async (payload) =>
{
throw new Exception("My custom exception");
});
// --8<-- [end:error_handling_batch_async]
// --8<-- [start:unauthorized_exception]
app.OnPublish("/default/channel", (payload) =>
{
throw new UnauthorizedException("My custom exception");
});
// --8<-- [end:unauthorized_exception]