Table of Contents

Method EnsureServiceSuccess

Namespace
NATS.Net
Assembly
NATS.Client.Services.dll

EnsureServiceSuccess<T>(NatsMsg<T>, bool)

Throws NatsSvcEndpointException when the response carries a Nats-Service-Error header.

public static NatsMsg<T> EnsureServiceSuccess<T>(this NatsMsg<T> msg, bool throwOnNoResponders = true)

Parameters

msg NatsMsg<T>

The response message to inspect.

throwOnNoResponders bool

When true (the default), throws NatsNoRespondersException if the response is a no-responders sentinel.

Returns

NatsMsg<T>

The same message, to allow fluent chaining.

Type Parameters

T

Message payload type.

Exceptions

NatsSvcEndpointException

Thrown when the response carries a service error.

NatsNoRespondersException

Thrown when throwOnNoResponders is true and no service responded.