\R1ddlmZddlmZddlmZmZmZmZm Z ddl Z ddl m Z erddlmZGdde jjZed d Gd d eZGd deZGddeZGddeZGddeZGddeZGddeZGdde jjZGddeZGddeZGdd eZGd!d"eZGd#d$eeZGd%d&eeZ Gd'd(eeZ!Gd)d*eZ"Gd+d,eZ#Gd-d.eZ$Gd/d0eZ%Gd1d2eZ&Gd3d4eZ'Gd5d6eZ(Gd7d8eZ)Gd9d:eZ*Gd;deZ,dS)?) annotations) dataclass) TYPE_CHECKINGAnyDictNoReturnOptionalN)api)Msgc$eZdZdZd d dZd d ZdS) ErrorzB An Error raised by the NATS client when using JetStream. N description Optional[str]returnNonec||_dSNrselfrs n/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/nats/js/errors.py__init__zError.__init__ &strcFd}|jr|j}d|jjd|S)Nznats: JetStream. )r __class____name__)rdescs r__str__z Error.__str__#s5   $#DB$."9BBDBBBrr)rrrrrrr __module__ __qualname____doc__rr"rrr r sQ'''''CCCCCCrr F)reprinitceZdZUdZded<ded<ded<ded<ded< ddd ZeddZeddZddZ d S)APIErrorzI An Error that is the result of interacting with NATS JetStream. Optional[int]codeerr_coderrstreamseqNrrcL||_||_||_||_||_dSr)r.r/rr0r1)rr.rr/r0r1s rrzAPIError.__init__6s,   & rmsgr rc|jt|jtjj}|tjjkrt|jtjj}tt||)N)r.r) headerr,r HeaderSTATUS StatusCodeSERVICE_UNAVAILABLEServiceUnavailableError DESCRIPTIONint)clsr3r.r!s rfrom_msgzAPIError.from_msgDs` : Nz#*+, 3>5 5 5) ):cj45DD t<<< vT$ZZ( v v v vdm v vcgcs v v v r)NNNNN) r.r-rrr/r-r0rr1r-rr)r3r rr)r?r@r#) r r%r&r'__annotations__r classmethodr>rEr"r(rrr,r,*s#%)"& $!     ===[= " " "[ "      rr,ceZdZdZdS)r:z A 503 error Nr r%r&r'r(rrr:r:c Drr:ceZdZdZdS)rBz A 500 error NrNr(rrrBrBkrOrrBceZdZdZdS)rCz A 404 error NrNr(rrrCrCsrOrrCceZdZdZdS)rDz A 400 error. NrNr(rrrDrD{rOrrDceZdZdZddZdS)NoStreamResponseErrorzD Raised if the client gets a 503 when publishing a message. rrcdS)Nznats: no response from streamr(rJs rr"zNoStreamResponseError.__str__s..rNr#r r%r&r'r"r(rrrTrTs2//////rrTceZdZdZddZdS)TooManyStalledMsgsErrorzX Raised when too many outstanding async published messages are waiting for ack. rrcdS)Nz@nats: stalled with too many outstanding async published messagesr(rJs rr"zTooManyStalledMsgsError.__str__sQQrNr#rVr(rrrXrXs8RRRRRRrrXceZdZdZddZdS)FetchTimeoutErrorz@ Raised if the consumer timed out waiting for messages. rrcdS)Nznats: fetch timeoutr(rJs rr"zFetchTimeoutError.__str__$$rNr#rVr(rrr[r[s2%%%%%%rr[c*eZdZdZ dd dZd dZdS) ConsumerSequenceMismatchErrorz Async error raised by the client with idle_heartbeat mode enabled when one of the message sequences is not the expected one. Nrrc0||_||_||_dSr)stream_resume_sequenceconsumer_sequencelast_consumer_sequence)rrarbrcs rrz&ConsumerSequenceMismatchError.__init__s" '=#!2&<###rrcJ|j|jz }d|jd|d|jS)Nz1nats: sequence mismatch for consumer at sequence z (zA sequences behind), should restart consumer from stream sequence )rcrbra)rgaps rr"z%ConsumerSequenceMismatchError.__str__sO)D,BB t@V t t t tVZVq t t rNNNrrr#r$r(rrr_r_sV $# =====      rr_ceZdZdZdS)BucketNotFoundErrorzM When attempted to bind to a JetStream KeyValue that does not exist. NrNr(rrririrOrriceZdZdS)BadBucketErrorN)r r%r&r(rrrkrksDrrkceZdZdZdS) KeyValueErrorzL Raised when there is an issue interacting with the KeyValue store. NrNr(rrrmrmrOrrmc$eZdZdZdd dZd dZdS) KeyDeletedErrorz[ Raised when trying to get a key that was deleted from a JetStream KeyValue store. Nrrc"||_||_dSr)entryop)rrqrrs rrzKeyDeletedError.__init__s rrcdS)Nznats: key was deletedr(rJs rr"zKeyDeletedError.__str__s&&r)NNrgr#r$r(rrrorosK''''''rroc$eZdZdZdd dZd dZdS) KeyNotFoundErrorz_ Raised when trying to get a key that does not exists from a JetStream KeyValue store. Nrrc0||_||_||_dSr)rqrrmessage)rrqrrrws rrzKeyNotFoundError.__init__s  rrc2d}|jr |d|jz }|S)Nznats: key not foundz: )rw)rss rr"zKeyNotFoundError.__str__s+ ! < % $dl$$ $Arrfrgr#r$r(rrrurusK rruc$eZdZdZdd dZd dZdS) KeyWrongLastSequenceErrorzJ Raised when trying to update a key with the wrong last sequence. Nrrc||_dSrrrs rrz"KeyWrongLastSequenceError.__init__rrrcd|jS)NrGrrJs rr"z!KeyWrongLastSequenceError.__str__s*(***rrrgr#r$r(rrr{r{sK'''''++++++rr{ceZdZddZdS) NoKeysErrorrrcdS)Nznats: no keys foundr(rJs rr"zNoKeysError.__str__r]rNr#r r%r&r"r(rrrrs(%%%%%%rrceZdZddZdS)KeyHistoryTooLargeErrorrrcdS)Nz$nats: history limited to a max of 64r(rJs rr"zKeyHistoryTooLargeError.__str__s55rNr#rr(rrrrs(666666rrceZdZdZdS)InvalidKeyErrorzO Raised when trying to put an object in Key Value with an invalid key. NrNr(rrrrrOrrceZdZdZdS)InvalidBucketNameErrorzL Raised when trying to create a KV or OBJ bucket with invalid name. NrNr(rrrrrOrrceZdZdZdS)InvalidObjectNameErrorzO Raised when trying to put an object in Object Store with invalid key. NrNr(rrrrrOrrceZdZdZdS)BadObjectMetaErrorzJ Raised when trying to read corrupted metadata from Object Store. NrNr(rrrrrOrrceZdZdZdS)LinkIsABucketErrorzN Raised when trying to get object from Object Store that is a bucket. NrNr(rrrrrOrrceZdZdZdS)DigestMismatchErrorzd Raised when getting an object from Object Store that has a different digest than expected. NrNr(rrrr&rOrrceZdZdZdS)ObjectNotFoundErrorzA When attempted to lookup an Object that does not exist. NrNr(rrrr.rOrrceZdZdZdS)ObjectDeletedErrorzM When attempted to do an operation to an Object that does not exist. NrNr(rrrr6rOrrceZdZdZdS)ObjectAlreadyExistszL When attempted to do an operation to an Object that already exist. NrNr(rrrr>rOrr)- __future__r dataclassesrtypingrrrrr nats.errorsnatsnats.jsr nats.aio.msgr errorsr r,r:rBrCrDrTrX TimeoutErrorr[r_rirkrmrorur{rrrrrrrrrrrr(rrrsB#"""""!!!!!!??????????????!       C C C C CDK  C C C E"""5 5 5 5 5 u5 5 #"5 p     h        (        H        h   /////E///RRRRReRRR%%%%% 0%%%     E   0     -        X        H    ' ' ' ' 'm] ' ' '}m" + + + + +  + + +%%%%%-%%% 66666m666      e        U        U                        %        -                %     r