microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v2.0.8

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

core/src/Microsoft.Teams.Core/BotHandlerException.cs

55lines · modepreview

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.Teams.Core.Schema;

namespace Microsoft.Teams.Core;

/// <summary>
/// Represents errors that occur during bot activity processing and provides context about the associated activity.
/// </summary>
/// <remarks>Use this exception to capture and propagate errors that occur during bot activity handling, along
/// with contextual information about the activity involved. This can aid in debugging and error reporting
/// scenarios.</remarks>
public class BotHandlerException : Exception
{
    /// <summary>
    /// Initializes a new instance of the <see cref="BotHandlerException"/> class.
    /// </summary>
    public BotHandlerException()
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="BotHandlerException"/> class with a specified error message.
    /// </summary>
    /// <param name="message">The error message that describes the reason for the exception.</param>
    public BotHandlerException(string message) : base(message)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="BotHandlerException"/> class with a specified error message and inner exception.
    /// </summary>
    /// <param name="message">The error message that describes the reason for the exception.</param>
    /// <param name="innerException">The underlying exception that caused this exception, or null if no inner exception is specified.</param>
    public BotHandlerException(string message, Exception innerException) : base(message, innerException)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="BotHandlerException"/> class with a specified error message, inner exception, and activity.
    /// </summary>
    /// <param name="message">The error message that describes the reason for the exception.</param>
    /// <param name="innerException">The underlying exception that caused this exception, or null if no inner exception is specified.</param>
    /// <param name="activity">The bot activity associated with the error. Cannot be null.</param>
    public BotHandlerException(string message, Exception innerException, CoreActivity activity) : base(message, innerException)
    {
        Activity = activity;
    }

    /// <summary>
    /// Gets the bot activity associated with the exception, or null if no activity was provided.
    /// </summary>
    public CoreActivity? Activity { get; }
}