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 is sealed, so a when over it is exhaustive without an else branch 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/check before 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.

    CancellationException is never wrapped: cancelling a coroutine is not a NATS failure, and natsy rethrows it untouched so structured concurrency keeps working.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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
    • Constructor Detail

    • Method Detail