fjdZddlZddlZddlZddlZddlmZddlmZ ej dZ Gdde Z Gdd e ZGd d eZGd d eZGddeZGdde ZGddeZGdde ZGdde ZGddeZGdde ZdS)z/ This module contains custom exception classes N)Optional)gettext exc_loggerc `eZdZdZddddddedededed eed df fd Zd efd Z xZ S) XRayErrorz X-Ray internal exception class. Adds an 'error' status and stores information about occurred exception. Provides JSON encoded info about occurred exception. errorN)flagextraerrnocontextmessager r r r returnct|d|_||_||_||_||_||_dS)Nr)super__init__statusreason extra_data type_flagr r )selfr r r r r __class__s O/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/internal/exceptions.pyrzXRayError.__init__sK !!!    c|jdkr d|jd}n d|ji}|j |j|d<tj|S)Nwarningsuccess)resultrrr )rrr jsondumps)rmsgs r__str__zXRayError.__str__'sX >Y & &#;CC $+C < #!\C Nz#r) __name__ __module__ __qualname____doc__strdictintrrr! __classcell__rs@rrrs 5<#$+/    c  ,/ "4. 48               rrceZdZdZdS)XRayManagerErrorz( X-Ray Manager exception class. Nr"r#r$r%rrr,r,6rr,c$eZdZdZdfd ZxZS)XRayManagerExitz Raised when we want to exit the X-Ray Manager with given exitcode and message. This error and it's subclasses are not sent to sentry. c L||_tjdd|i|dS)Nr r.)exitcoderr)rr r4kwargsrs rrzXRayManagerExit.__init__Cs2  333F33333r)r2)r"r#r$r%rr)r*s@rr1r1<sG 4444444444rr1c,eZdZdZdedeffd ZxZS)XRayManagerExitPHPUnsupportedzG Raised when given php version is not supported by x-ray tool. url php_versionc||_||_tt dt ||dS)NzH%(url)s is served by %(real_php_version)s, which is unsupported by X-Ray)r8real_php_versionr r )r8r9rr_r')rr8r9rs rrz&XRayManagerExitPHPUnsupported.__init__Lsd& 455S;???  A A A A Arr"r#r$r%r&rr)r*s@rr7r7HsaACAcAAAAAAAAAArr7c(eZdZdZdeffd ZxZS)TaskNotFoundErrorz. X-Ray API reports about missing task task_idc||_ttdt |dS)Nz.Task with id %(task_id)s not found in database)rAr<)rArrr=r')rrArs rrzTaskNotFoundError.__init__[sV  FGG      rr>r*s@rr@r@VsNrr@ceZdZdZdS) XRayAPIErrorz, X-Ray API exception special class. Nr-r.rrrDrDdr/rrDc:eZdZdZddedeeffd ZxZS)XRayAPIEmptyResponsez1 Happens when API returns empty response Nrr c ||_tjd|ptdt |zt |d|dS)NzReceived empty result: %s)r)r r r.)rrrr=r&r')rrr r5rs rrzXRayAPIEmptyResponse.__init__osm  Kq!<==F Kf%%%       r)N) r"r#r$r%r'rr&rr)r*s@rrFrFjs^  t hsm          rrFceZdZdZdS)XRayAgentErrorz% X-Ray Agent exception class Nr-r.rrrIrIxr/rrIceZdZdZdS)XRayMailerErrorz& X-Ray Mailer exception class Nr-r.rrrKrK~r/rrKc>eZdZdZedfdeffd ZxZS)XRayMissingDomainz( Missing domain exception class z6Domain '%(domain_name)s' does not exist on this server domain_namecz||_t|dt|dS)Nr2)rN)r r4r )rNrrr')rrNr rs rrzXRayMissingDomain.__init__sJ& [111      r)r"r#r$r%r=r&rr)r*s@rrMrMsc233k1l1l  C          rrMceZdZdZdS)SmartAdvicePluginErrorzD Error when something bad happened with Smart Advice plugin Nr-r.rrrQrQr/rrQ)r%rloggingossystypingrxrayrr= getLoggerlogger Exceptionrr,r1r7r@rDrFrIrKrMrQr.rrrZsM    < ( ( By 4 4 4 4 4& 4 4 4 A A A A AO A A A        9      <    Y i          Yr