
                            S r SSKJr  SSKJr  SSKJr   " S S\R                  5      r	 " S S\	5      r
 " S S	\	5      r " S
 S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S  S!\	5      r " S" S#\	5      r " S$ S%\	5      rS& r " S' S(\R6                  5      rg))*z2Exceptions raised by Testing API libs or commands.    	exit_code)
exceptionsc                       \ rS rSrSrSrg)TestingError   z Base class for testing failures. N__name__
__module____qualname____firstlineno____doc____static_attributes__r	       6lib/googlecloudsdk/api_lib/firebase/test/exceptions.pyr   r      s    (r   r   c                       \ rS rSrSrSrg)MissingProjectError   z+No GCP project was specified for a command.r	   Nr
   r	   r   r   r   r      s    3r   r   c                       \ rS rSrSrSrg)BadMatrixError    z>BadMatrixException is for test matrices that fail prematurely.r	   Nr
   r	   r   r   r   r       s    Fr   r   c                       \ rS rSrSrSrg)RestrictedServiceError$   zRestrictedServiceError is for bad service request errors.

This is most likely due to allowlisted API features which are hidden behind a
visibility label.
r	   Nr
   r	   r   r   r   r   $   s    r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )ModelNotFoundError,   z>Failed to find a device model in the test environment catalog.c                 F   > [         [        U ]  SR                  US95        g )Nz'{id}' is not a valid modelid)superr   __init__format)selfmodel_id	__class__s     r   r#   ModelNotFoundError.__init__/   s$    	
d,%,,,9;r   r	   r   r   r   r   r   r#   r   __classcell__r'   s   @r   r   r   ,   s    F; ;r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )VersionNotFoundError4   z=Failed to find an OS version in the test environment catalog.c                 F   > [         [        U ]  SR                  US95        g )Nz'{v}' is not a valid OS versionv)r"   r-   r#   r$   r%   versionr'   s     r   r#   VersionNotFoundError.__init__7   s$    	
.)0070;=r   r	   r)   r+   s   @r   r-   r-   4   s    E= =r   r-   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )NetworkProfileNotFoundError<   zAFailed to find a network profile in the test environment catalog.c                 F   > [         [        U ]  SR                  US95        g )Nz(Could not find network profile ID '{id}'r    )r"   r6   r#   r$   )r%   
profile_idr'   s     r   r#   $NetworkProfileNotFoundError.__init__?   s%    	
%t5299Z9HJr   r	   r)   r+   s   @r   r6   r6   <   s    IJ Jr   r6   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )LocaleNotFoundErrorD   z8Failed to find a locale in the test environment catalog.c                 F   > [         [        U ]  SR                  US95        g )Nz'{l}' is not a valid locale)l)r"   r<   r#   r$   )r%   localer'   s     r   r#   LocaleNotFoundError.__init__G   s$    	
t-%,,v,68r   r	   r)   r+   s   @r   r<   r<   D   s    @8 8r   r<   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )OrientationNotFoundErrorL   z>Failed to find an orientation in the test environment catalog.c                 F   > [         [        U ]  SR                  US95        g )Nz''{o}' is not a valid device orientation)o)r"   rC   r#   r$   )r%   orientationr'   s     r   r#   !OrientationNotFoundError.__init__O   s%    	
"D2188;8GIr   r	   r)   r+   s   @r   rC   rC   L   s    FI Ir   rC   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )DefaultDimensionNotFoundErrorT   zCFailed to find a 'default' tag on any value for a device dimension.c                 F   > [         [        U ]  SR                  US95        g )Nz2Test Lab did not provide a default value for '{d}'d)r"   rJ   r#   r$   r%   dim_namer'   s     r   r#   &DefaultDimensionNotFoundError.__init__W   s%    	
'7<CChCOQr   r	   r)   r+   s   @r   rJ   rJ   T   s    KQ Qr   rJ   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )InvalidDimensionNameError\   z6An invalid test matrix dimension name was encountered.c                 F   > [         [        U ]  SR                  US95        g )Nzb'{d}' is not a valid dimension name. Must be one of: ['model', 'version', 'locale', 'orientation']rM   )r"   rS   r#   r$   rO   s     r   r#   "InvalidDimensionNameError.__init___   s%    	
#T3	88>8JLr   r	   r)   r+   s   @r   rS   rS   \   s    >L Lr   rS   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )XcodeVersionNotFoundErrore   z@Failed to find an Xcode version in the test environment catalog.c                 F   > [         [        U ]  SR                  US95        g )Nz&'{v}' is not a supported Xcode versionr0   )r"   rX   r#   r$   r2   s     r   r#   "XcodeVersionNotFoundError.__init__h   s%    	
#T3077'7BDr   r	   r)   r+   s   @r   rX   rX   e   s    HD Dr   rX   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )TestExecutionNotFoundErrorm   z7A test execution ID was not found within a test matrix.c                 F   > [         [        U ]  SR                  XS95        g )Nz/Test execution [{e}] not found in matrix [{m}].)em)r"   r]   r#   r$   )r%   execution_id	matrix_idr'   s      r   r#   #TestExecutionNotFoundError.__init__p   s"    	
$d49	,	,.r   r	   r)   r+   s   @r   r]   r]   m   s    ?. .r   r]   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )IncompatibleApiEndpointsErrorv   zDTwo or more API endpoint overrides are incompatible with each other.c                 J   > [         [        U ]  SR                  X5      5        g )Nz5Service endpoints [{0}] and [{1}] are not compatible.)r"   rf   r#   r$   )r%   	endpoint1	endpoint2r'   s      r   r#   &IncompatibleApiEndpointsError.__init__y   s     	
'7?			%'r   r	   r)   r+   s   @r   rf   rf   v   s    L' 'r   rf   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )InvalidTestArgError   z?An invalid/unknown test argument was found in an argument file.c                 J   > [         [        U ]  SR                  U5      5        g )Nz8[{0}] is not a valid argument name for: gcloud test run.)r"   rm   r#   r$   )r%   arg_namer'   s     r   r#   InvalidTestArgError.__init__   s     	
t-B		r   r	   r)   r+   s   @r   rm   rm      s    G r   rm   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )TestLabInfrastructureError   zDEncountered a Firebase Test Lab infrastructure error during testing.c                 d   > [         [        U ]  SR                  U5      [        R
                  S9  g )Nz-Firebase Test Lab infrastructure failure: {0}r   )r"   rs   r#   r$   r   INFRASTRUCTURE_ERR)r%   errorr'   s     r   r#   #TestLabInfrastructureError.__init__   s/    	
$d47>>uE.. 5 0r   r	   r)   r+   s   @r   rs   rs      s    L0 0r   rs   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )AllDimensionsIncompatibleError   z8All device dimensions in a test matrix are incompatible.c                 F   > [         [        U ]  U[        R                  S9  g )Nr   )r"   rz   r#   r   UNSUPPORTED_ENV)r%   msgr'   s     r   r#   'AllDimensionsIncompatibleError.__init__   s#    	
($8y00 9 2r   r	   r)   r+   s   @r   rz   rz      s    @2 2r   rz   c                 4    U S:X  a  gU R                  SS5      $ )zConverts an internal arg name into its corresponding user-visible name.

This is used for creating exceptions using user-visible arg names.

Args:
  arg_internal_name: the internal name of an argument.

Returns:
  The user visible name for the argument.
async_async_-)replace)arg_internal_names    r   ExternalArgNameFromr      s$     (" 		"	"3	,,r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )InvalidArgException   zInvalidArgException is for malformed gcloud firebase test argument values.

It provides a wrapper around Calliope's InvalidArgumentException that
conveniently converts internal arg names with underscores into the external
arg names with hyphens.
c                 @   > [         [        U ]  [        U5      U5        g )N)r"   r   r#   r   )r%   
param_namemessager'   s      r   r#   InvalidArgException.__init__   s    	
t-J'2r   r	   r)   r+   s   @r   r   r      s    2 2r   r   N)r   $googlecloudsdk.api_lib.firebase.testr   googlecloudsdk.callioper   calliope_exceptionsgooglecloudsdk.corecore_exceptionsErrorr   r   r   r   r   r-   r6   r<   rC   rJ   rS   rX   r]   rf   rm   rs   rz   r   InvalidArgumentExceptionr   r	   r   r   <module>r      s    9 ; E =)?(( )4, 4G\ G\ ; ;=< =J, J8, 8I| IQL QL LD D. .'L ', 0 02\ 2-$
2-FF 
2r   