Class VonageHttpRequestException
- Namespace
- Vonage.Common.Exceptions
- Assembly
- Vonage.dll
Represents an issue when processing an HttpRequest.
public class VonageHttpRequestException : HttpRequestException, ISerializable
- Inheritance
-
VonageHttpRequestException
- Implements
- Inherited Members
Examples
throw new VonageHttpRequestException("Request failed")
{
HttpStatusCode = HttpStatusCode.BadRequest,
Json = "{\"error\":\"invalid_request\"}"
};
Constructors
VonageHttpRequestException(Exception)
Creates a VonageHttpRequestException.
public VonageHttpRequestException(Exception inner)
Parameters
innerExceptionThe inner exception.
Examples
try { /* http operation */ }
catch (Exception ex)
{
throw new VonageHttpRequestException(ex);
}
VonageHttpRequestException(string)
Creates a VonageHttpRequestException.
public VonageHttpRequestException(string message)
Parameters
messagestringThe exception message.
Examples
throw new VonageHttpRequestException("Server returned an error");
Properties
HttpStatusCode
The response status code.
public HttpStatusCode HttpStatusCode { get; init; }
Property Value
Examples
catch (VonageHttpRequestException ex)
{
if (ex.HttpStatusCode == HttpStatusCode.NotFound) { /* handle 404 */ }
}
Json
The response body content.
public string Json { get; init; }
Property Value
Examples
catch (VonageHttpRequestException ex)
{
Console.WriteLine($"Error response: {ex.Json}");
}