microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Apps/Events/ErrorEvent.cs
26lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Api.Activities; |
| 5 | using Microsoft.Teams.Apps.Plugins; |
| 6 | |
| 7 | namespace Microsoft.Teams.Apps.Events; |
| 8 | |
| 9 | public class ErrorEvent : Event |
| 10 | { |
| 11 | public required Exception Exception { get; set; } |
| 12 | public IContext<IActivity>? Context { get; set; } |
| 13 | } |
| 14 | |
| 15 | public static partial class AppEventExtensions |
| 16 | { |
| 17 | public static App OnError(this App app, Action<IPlugin, ErrorEvent> handler) |
| 18 | { |
| 19 | return app.OnEvent(EventType.Error, handler); |
| 20 | } |
| 21 | |
| 22 | public static App OnError(this App app, Func<IPlugin, ErrorEvent, CancellationToken, Task> handler) |
| 23 | { |
| 24 | return app.OnEvent(EventType.Error, handler); |
| 25 | } |
| 26 | } |