Table of Contents

Class HttpRequestFailedException

Namespace
Mailtrap.Core.Exceptions
Assembly
Mailtrap.Abstractions.dll

Exception which is thrown when the request sent to the Mailtrap API was not valid.

public sealed class HttpRequestFailedException : MailtrapApiException, ISerializable
Inheritance
HttpRequestFailedException
Implements
Inherited Members

Constructors

HttpRequestFailedException(Uri, HttpMethod, HttpStatusCode, string, string?)

Initializes a new instance of the exception with failed API details, defined by requestUri and httpMethod.
Additionally provides statusCode and content which were received as a response.
public HttpRequestFailedException(Uri requestUri, HttpMethod httpMethod, HttpStatusCode statusCode, string reason, string? message = null)

Parameters

requestUri Uri
API endpoint that thrown exception.
httpMethod HttpMethod
HTTP method that thrown exception.
statusCode HttpStatusCode

HTTP status code that was returned.

reason string

HTTP status reason that was returned.

message string

Text representation of the error.

Exceptions

ArgumentNullException

When the requestUri or httpMethod is null.

ArgumentNullException

When the statusCode is null.

Properties

Reason

Gets HTTP status reason that was returned.

public string Reason { get; }

Property Value

string

HTTP status reason that was returned.

StatusCode

Gets HTTP status code that was returned.

public HttpStatusCode StatusCode { get; }

Property Value

HttpStatusCode

HTTP status code that was returned.