
                         
   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ  G d dej                        Z G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z G d% d&e      Z G d' d(e      Zd) Z G d* d+e	j>                        Z y,)-z2Exceptions raised by Testing API libs or commands.    )absolute_import)division)unicode_literals	exit_code)
exceptionsc                       e Zd ZdZy)TestingErrorz Base class for testing failures.N__name__
__module____qualname____doc__     6lib/googlecloudsdk/api_lib/firebase/test/exceptions.pyr
   r
      s    (r   r
   c                       e Zd ZdZy)MissingProjectErrorz+No GCP project was specified for a command.Nr   r   r   r   r   r      s    3r   r   c                       e Zd ZdZy)BadMatrixErrorz>BadMatrixException is for test matrices that fail prematurely.Nr   r   r   r   r   r   #   s    Fr   r   c                       e Zd ZdZy)RestrictedServiceErrorzRestrictedServiceError is for bad service request errors.

  This is most likely due to allowlisted API features which are hidden behind a
  visibility label.
  Nr   r   r   r   r   r   '   s    r   r   c                   "     e Zd ZdZ fdZ xZS )ModelNotFoundErrorz>Failed to find a device model in the test environment catalog.c                 L    t         t        |   dj                  |             y )Nz'{id}' is not a valid modelid)superr   __init__format)selfmodel_id	__class__s     r   r   zModelNotFoundError.__init__2   s$    	
d,%,,,9;r   r   r   r   r   r   __classcell__r#   s   @r   r   r   /   s    F; ;r   r   c                   "     e Zd ZdZ fdZ xZS )VersionNotFoundErrorz=Failed to find an OS version in the test environment catalog.c                 L    t         t        |   dj                  |             y )Nz'{v}' is not a valid OS versionv)r   r(   r   r    r!   versionr#   s     r   r   zVersionNotFoundError.__init__:   s$    	
.)0070;=r   r$   r&   s   @r   r(   r(   7   s    E= =r   r(   c                   "     e Zd ZdZ fdZ xZS )NetworkProfileNotFoundErrorzAFailed to find a network profile in the test environment catalog.c                 L    t         t        |   dj                  |             y )Nz(Could not find network profile ID '{id}'r   )r   r/   r   r    )r!   
profile_idr#   s     r   r   z$NetworkProfileNotFoundError.__init__B   s%    	
%t5299Z9HJr   r$   r&   s   @r   r/   r/   ?   s    IJ Jr   r/   c                   "     e Zd ZdZ fdZ xZS )LocaleNotFoundErrorz8Failed to find a locale in the test environment catalog.c                 L    t         t        |   dj                  |             y )Nz'{l}' is not a valid locale)l)r   r3   r   r    )r!   localer#   s     r   r   zLocaleNotFoundError.__init__J   s$    	
t-%,,v,68r   r$   r&   s   @r   r3   r3   G   s    @8 8r   r3   c                   "     e Zd ZdZ fdZ xZS )OrientationNotFoundErrorz>Failed to find an orientation in the test environment catalog.c                 L    t         t        |   dj                  |             y )Nz''{o}' is not a valid device orientation)o)r   r8   r   r    )r!   orientationr#   s     r   r   z!OrientationNotFoundError.__init__R   s%    	
"D2188;8GIr   r$   r&   s   @r   r8   r8   O   s    FI Ir   r8   c                   "     e Zd ZdZ fdZ xZS )DefaultDimensionNotFoundErrorzCFailed to find a 'default' tag on any value for a device dimension.c                 L    t         t        |   dj                  |             y )Nz2Test Lab did not provide a default value for '{d}'d)r   r=   r   r    r!   dim_namer#   s     r   r   z&DefaultDimensionNotFoundError.__init__Z   s%    	
'7<CChCOQr   r$   r&   s   @r   r=   r=   W   s    KQ Qr   r=   c                   "     e Zd ZdZ fdZ xZS )InvalidDimensionNameErrorz6An invalid test matrix dimension name was encountered.c                 L    t         t        |   dj                  |             y )Nzb'{d}' is not a valid dimension name. Must be one of: ['model', 'version', 'locale', 'orientation']r?   )r   rD   r   r    rA   s     r   r   z"InvalidDimensionNameError.__init__b   s%    	
#T3	88>8JLr   r$   r&   s   @r   rD   rD   _   s    >L Lr   rD   c                   "     e Zd ZdZ fdZ xZS )XcodeVersionNotFoundErrorz@Failed to find an Xcode version in the test environment catalog.c                 L    t         t        |   dj                  |             y )Nz&'{v}' is not a supported Xcode versionr*   )r   rG   r   r    r,   s     r   r   z"XcodeVersionNotFoundError.__init__k   s%    	
#T3077'7BDr   r$   r&   s   @r   rG   rG   h   s    HD Dr   rG   c                   "     e Zd ZdZ fdZ xZS )TestExecutionNotFoundErrorz7A test execution ID was not found within a test matrix.c                 N    t         t        |   dj                  ||             y )Nz/Test execution [{e}] not found in matrix [{m}].)em)r   rJ   r   r    )r!   execution_id	matrix_idr#   s      r   r   z#TestExecutionNotFoundError.__init__s   s$    	
$d49	,)	,.r   r$   r&   s   @r   rJ   rJ   p   s    ?. .r   rJ   c                   "     e Zd ZdZ fdZ xZS )IncompatibleApiEndpointsErrorzDTwo or more API endpoint overrides are incompatible with each other.c                 L    t         t        |   dj                  ||             y )Nz5Service endpoints [{0}] and [{1}] are not compatible.)r   rQ   r   r    )r!   	endpoint1	endpoint2r#   s      r   r   z&IncompatibleApiEndpointsError.__init__|   s"    	
'7?		9	%'r   r$   r&   s   @r   rQ   rQ   y   s    L' 'r   rQ   c                   "     e Zd ZdZ fdZ xZS )InvalidTestArgErrorz?An invalid/unknown test argument was found in an argument file.c                 J    t         t        |   dj                  |             y )Nz8[{0}] is not a valid argument name for: gcloud test run.)r   rV   r   r    )r!   arg_namer#   s     r   r   zInvalidTestArgError.__init__   s     	
t-B		r   r$   r&   s   @r   rV   rV      s    G r   rV   c                   "     e Zd ZdZ fdZ xZS )TestLabInfrastructureErrorzDEncountered a Firebase Test Lab infrastructure error during testing.c                 j    t         t        |   dj                  |      t        j
                         y )Nz-Firebase Test Lab infrastructure failure: {0}r   )r   rZ   r   r    r   INFRASTRUCTURE_ERR)r!   errorr#   s     r   r   z#TestLabInfrastructureError.__init__   s/    	
$d47>>uE.. 5 0r   r$   r&   s   @r   rZ   rZ      s    L0 0r   rZ   c                   "     e Zd ZdZ fdZ xZS )AllDimensionsIncompatibleErrorz8All device dimensions in a test matrix are incompatible.c                 L    t         t        |   |t        j                         y )Nr   )r   r_   r   r   UNSUPPORTED_ENV)r!   msgr#   s     r   r   z'AllDimensionsIncompatibleError.__init__   s#    	
($8y00 9 2r   r$   r&   s   @r   r_   r_      s    @2 2r   r_   c                 2    | dk(  ry| j                  dd      S )a
  Converts 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   ExternalArgNameFromrj      s$     (" 		"	"3	,,r   c                   "     e Zd ZdZ fdZ xZS )InvalidArgExceptionzInvalidArgException 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                 @    t         t        |   t        |      |       y )N)r   rl   r   rj   )r!   
param_namemessager#   s      r   r   zInvalidArgException.__init__   s    	
t-J'2r   r$   r&   s   @r   rl   rl      s    2 2r   rl   N)!r   
__future__r   r   r   $googlecloudsdk.api_lib.firebase.testr   googlecloudsdk.callioper   calliope_exceptionsgooglecloudsdk.corecore_exceptionsErrorr
   r   r   r   r   r(   r/   r3   r8   r=   rD   rG   rJ   rQ   rV   rZ   r_   rj   InvalidArgumentExceptionrl   r   r   r   <module>rx      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   