Class NatsyException
-
- All Implemented Interfaces:
-
java.io.Serializable
public class NatsyException extends RuntimeException
Anything that went wrong talking to NATS.
Every natsy operation reports failure by throwing one of these, so
catch (e: NatsyException)catches all of them and nothing else. The type issealed, so awhenover it is exhaustive without anelsebranch and adding a case is a compile error at every call site that matched exhaustively.Not a NatsyException: IllegalArgumentException and IllegalStateException. Those mean the call was wrong - a blank subject, a pause deadline in the past, a batch size larger than the consumer allows - and they are raised by
require/checkbefore anything reaches the server. A NatsyException means the operation was well-formed and failed anyway. Keeping the two apart is what lets a retry loop catch the second without also swallowing its own bugs.CancellationExceptionis never wrapped: cancelling a coroutine is not a NATS failure, and natsy rethrows it untouched so structured concurrency keeps working.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringmessageprivate final Throwablecauseprivate final StringlocalizedMessageprivate final Array<Throwable>suppressedprivate Array<StackTraceElement>stackTrace
-
Method Summary
Modifier and Type Method Description -
Methods inherited from class kotlin.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-