< Summary

Information
Class: TeleFlow.Telegram.TelegramServerException
Assembly: TeleFlow.Telegram.Client
File(s): /_/src/TeleFlow.Telegram.Client/TelegramRequestException.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 259
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%

File(s)

/_/src/TeleFlow.Telegram.Client/TelegramRequestException.cs

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2
 3namespace TeleFlow.Telegram;
 4
 5[SuppressMessage(
 6    "Design",
 7    "CA1032:Implement standard exception constructors",
 8    Justification = "Telegram exceptions intentionally require message/context constructors so request diagnostics are n
 9public class TelegramException : Exception
 10{
 11    public TelegramException(string message, Exception? innerException = null)
 12        : base(message, innerException)
 13    {
 14    }
 15}
 16
 17[SuppressMessage(
 18    "Design",
 19    "CA1032:Implement standard exception constructors",
 20    Justification = "Telegram request exceptions intentionally keep Telegram context in the primary constructor.")]
 21public class TelegramRequestException : TelegramException
 22{
 23    public TelegramRequestException(
 24        string message,
 25        Exception? innerException = null,
 26        string? methodName = null,
 27        int? httpStatusCode = null,
 28        int? telegramErrorCode = null,
 29        string? description = null,
 30        int? retryAfterSeconds = null,
 31        TimeSpan? retryAfter = null,
 32        long? migrateToChatId = null)
 33        : base(message, innerException)
 34    {
 35        MethodName = methodName;
 36        HttpStatusCode = httpStatusCode;
 37        TelegramErrorCode = telegramErrorCode;
 38        Description = description;
 39        RetryAfterSeconds = retryAfterSeconds;
 40        RetryAfter = retryAfter ?? (retryAfterSeconds is null ? null : TimeSpan.FromSeconds(retryAfterSeconds.Value));
 41        MigrateToChatId = migrateToChatId;
 42    }
 43
 44    public string? MethodName { get; }
 45
 46    public int? HttpStatusCode { get; }
 47
 48    public int? TelegramErrorCode { get; }
 49
 50    public string? Description { get; }
 51
 52    public int? RetryAfterSeconds { get; }
 53
 54    public TimeSpan? RetryAfter { get; }
 55
 56    public long? MigrateToChatId { get; }
 57}
 58
 59[SuppressMessage(
 60    "Design",
 61    "CA1032:Implement standard exception constructors",
 62    Justification = "Telegram API exceptions intentionally keep Telegram API context in the primary constructor.")]
 63public class TelegramApiException : TelegramRequestException
 64{
 65    public TelegramApiException(
 66        string message,
 67        Exception? innerException = null,
 68        string? methodName = null,
 69        int? httpStatusCode = null,
 70        int? telegramErrorCode = null,
 71        string? description = null,
 72        int? retryAfterSeconds = null,
 73        TimeSpan? retryAfter = null,
 74        long? migrateToChatId = null)
 75        : base(
 76            message,
 77            innerException,
 78            methodName,
 79            httpStatusCode,
 80            telegramErrorCode,
 81            description,
 82            retryAfterSeconds,
 83            retryAfter,
 84            migrateToChatId)
 85    {
 86    }
 87}
 88
 89[SuppressMessage(
 90    "Design",
 91    "CA1032:Implement standard exception constructors",
 92    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 93public sealed class TelegramBadRequestException : TelegramApiException
 94{
 95    public TelegramBadRequestException(string message, string? methodName = null, int? httpStatusCode = null, int? teleg
 96        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 97    {
 98    }
 99}
 100
 101[SuppressMessage(
 102    "Design",
 103    "CA1032:Implement standard exception constructors",
 104    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 105public sealed class TelegramUnauthorizedException : TelegramApiException
 106{
 107    public TelegramUnauthorizedException(string message, string? methodName = null, int? httpStatusCode = null, int? tel
 108        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 109    {
 110    }
 111}
 112
 113[SuppressMessage(
 114    "Design",
 115    "CA1032:Implement standard exception constructors",
 116    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 117public sealed class TelegramForbiddenException : TelegramApiException
 118{
 119    public TelegramForbiddenException(string message, string? methodName = null, int? httpStatusCode = null, int? telegr
 120        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 121    {
 122    }
 123}
 124
 125[SuppressMessage(
 126    "Design",
 127    "CA1032:Implement standard exception constructors",
 128    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 129public sealed class TelegramNotFoundException : TelegramApiException
 130{
 131    public TelegramNotFoundException(string message, string? methodName = null, int? httpStatusCode = null, int? telegra
 132        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 133    {
 134    }
 135}
 136
 137[SuppressMessage(
 138    "Design",
 139    "CA1032:Implement standard exception constructors",
 140    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 141public sealed class TelegramConflictException : TelegramApiException
 142{
 143    public TelegramConflictException(string message, string? methodName = null, int? httpStatusCode = null, int? telegra
 144        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 145    {
 146    }
 147}
 148
 149[SuppressMessage(
 150    "Design",
 151    "CA1032:Implement standard exception constructors",
 152    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 153public sealed class TelegramEntityTooLargeException : TelegramApiException
 154{
 155    public TelegramEntityTooLargeException(string message, string? methodName = null, int? httpStatusCode = null, int? t
 156        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 157    {
 158    }
 159}
 160
 161[SuppressMessage(
 162    "Design",
 163    "CA1032:Implement standard exception constructors",
 164    Justification = "Telegram throttling exceptions intentionally keep retry metadata in the primary constructor.")]
 165public sealed class TelegramRetryAfterException : TelegramApiException
 166{
 167    public TelegramRetryAfterException(
 168        string message,
 169        string? methodName = null,
 170        int? httpStatusCode = null,
 171        int? telegramErrorCode = null,
 172        string? description = null,
 173        int? retryAfterSeconds = null,
 174        TimeSpan? retryAfter = null)
 175        : base(
 176            message,
 177            methodName: methodName,
 178            httpStatusCode: httpStatusCode,
 179            telegramErrorCode: telegramErrorCode,
 180            description: description,
 181            retryAfterSeconds: retryAfterSeconds,
 182            retryAfter: retryAfter)
 183    {
 184    }
 185}
 186
 187[SuppressMessage(
 188    "Design",
 189    "CA1032:Implement standard exception constructors",
 190    Justification = "Telegram migration exceptions intentionally keep migration metadata in the primary constructor.")]
 191public sealed class TelegramMigrateToChatException : TelegramApiException
 192{
 193    public TelegramMigrateToChatException(
 194        string message,
 195        string? methodName = null,
 196        int? httpStatusCode = null,
 197        int? telegramErrorCode = null,
 198        string? description = null,
 199        long? migrateToChatId = null)
 200        : base(
 201            message,
 202            methodName: methodName,
 203            httpStatusCode: httpStatusCode,
 204            telegramErrorCode: telegramErrorCode,
 205            description: description,
 206            migrateToChatId: migrateToChatId)
 207    {
 208    }
 209}
 210
 211[SuppressMessage(
 212    "Design",
 213    "CA1032:Implement standard exception constructors",
 214    Justification = "Telegram status exceptions intentionally keep Telegram API context in the primary constructor.")]
 215public sealed class TelegramServerException : TelegramApiException
 216{
 217    public TelegramServerException(string message, string? methodName = null, int? httpStatusCode = null, int? telegramE
 7218        : base(message, methodName: methodName, httpStatusCode: httpStatusCode, telegramErrorCode: telegramErrorCode, de
 219    {
 7220    }
 221}
 222
 223[SuppressMessage(
 224    "Design",
 225    "CA1032:Implement standard exception constructors",
 226    Justification = "Telegram network exceptions intentionally keep method and transport context in the primary construc
 227public sealed class TelegramNetworkException : TelegramRequestException
 228{
 229    public TelegramNetworkException(
 230        string message,
 231        Exception? innerException = null,
 232        string? methodName = null,
 233        int? httpStatusCode = null)
 234        : base(message, innerException, methodName, httpStatusCode)
 235    {
 236    }
 237}
 238
 239[SuppressMessage(
 240    "Design",
 241    "CA1032:Implement standard exception constructors",
 242    Justification = "Telegram decode exceptions intentionally keep method, response, and retry context in the primary co
 243public sealed class TelegramDecodeException : TelegramRequestException
 244{
 245    public TelegramDecodeException(
 246        string message,
 247        Exception? innerException = null,
 248        string? methodName = null,
 249        int? httpStatusCode = null,
 250        int? retryAfterSeconds = null)
 251        : base(
 252            message,
 253            innerException,
 254            methodName,
 255            httpStatusCode,
 256            retryAfterSeconds: retryAfterSeconds)
 257    {
 258    }
 259}