Class RestException
- Namespace
- Nyra.Exceptions
- Assembly
- Nyra.dll
A failed REST request against an audio node, carries the status code and error body when available.
public sealed class RestException : NyraException, ISerializable
- Inheritance
-
RestException
- Implements
- Inherited Members
Constructors
RestException(int, string, string?, TimeSpan?, Exception?)
Creates the exception.
public RestException(int statusCode, string path, string? responseBody, TimeSpan? retryAfter = null, Exception? innerException = null)
Parameters
statusCodeintThe HTTP status the server replied with.
pathstringThe path the failed request went to.
responseBodystringThe body the server replied with, null when it sent none.
retryAfterTimeSpan?The retry delay the server asked for, null when it sent none.
innerExceptionExceptionThe exception that caused this one, null when there is none.
Exceptions
- ArgumentNullException
pathis null.
Properties
Path
The path the failed request went to.
public string Path { get; }
Property Value
ResponseBody
The body the server replied with, null when it sent none.
public string? ResponseBody { get; }
Property Value
Remarks
A client-side parse failure carries the client's diagnostic instead of the body, a reply the server null-ed reads as null, the diagnostic is what the client kept. A body at or beyond the read bound is carried truncated with a marker.
RetryAfter
The retry delay the server asked for, null when it sent none.
public TimeSpan? RetryAfter { get; }
Property Value
Remarks
NodeLink's admission control answers 429 with this header, so the caller knows how long to wait before retrying.
StatusCode
The HTTP status the server replied with.
public int StatusCode { get; }
Property Value
Remarks
A failure raised on the client side (a body that did not parse) carries a synthetic 2xx, standing for the reply the server gave before its body failed the read. Only a real server reply carries its own status, including the route planner's empty 204, a success reported through the same type.