microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
devtools-port-no-auth

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.Common/Http/HttpException.cs

33lines · modeblame

82a4e3c3Rajan12 months ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
73e7847aAlex Acebo1 years ago4using System.Net;
5using System.Net.Http.Headers;
6using System.Text.Json;
7using System.Text.Json.Serialization;
8
9namespace Microsoft.Teams.Common.Http;
10
11public class HttpException : Exception
12{
13public required HttpResponseHeaders Headers { get; set; }
14public required HttpStatusCode StatusCode { get; set; }
15public HttpRequestMessage? Request { get; set; }
16public object? Body { get; set; }
17
18public override string ToString()
19{
b6c66549Alex Acebo6 months ago20return JsonSerializer.Serialize(new
20d75721Kavin1 years ago21{
b6c66549Alex Acebo6 months ago22headers = Headers,
23statusCode = StatusCode,
24body = Body
25}, new JsonSerializerOptions()
73e7847aAlex Acebo1 years ago26{
27WriteIndented = true,
b6c66549Alex Acebo6 months ago28IndentSize = 4,
29DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
30PropertyNamingPolicy = JsonNamingPolicy.CamelCase
73e7847aAlex Acebo1 years ago31});
32}
33}