Table of Contents

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

statusCode int

The HTTP status the server replied with.

path string

The path the failed request went to.

responseBody string

The body the server replied with, null when it sent none.

retryAfter TimeSpan?

The retry delay the server asked for, null when it sent none.

innerException Exception

The exception that caused this one, null when there is none.

Exceptions

ArgumentNullException

path is null.

Properties

Path

The path the failed request went to.

public string Path { get; }

Property Value

string

ResponseBody

The body the server replied with, null when it sent none.

public string? ResponseBody { get; }

Property Value

string

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

TimeSpan?

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

int

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.