
                             d 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j                        Z	 G d
 dej                        Z
ddZy)z>Wrapper for user-visible error exceptions to raise in the CLI.    )absolute_import)division)unicode_literals)
exceptionsc                       e Zd ZdZy)FunctionsErrorz Exceptions for Functions errors.N)__name__
__module____qualname____doc__     5lib/googlecloudsdk/api_lib/functions/v2/exceptions.pyr   r      s    (r   r   c                   "     e Zd ZdZ fdZ xZS )InvalidArgumentExceptionz4InvalidArgumentException is for malformed arguments.c                 Z    t         t        |   dj                  ||             || _        y)zCreates InvalidArgumentException.

    Args:
      parameter_name: str, the parameter flag or argument name
      message: str, the exception message
    zInvalid value for [{0}]: {1}N)superr   __init__formatparameter_nameselfr   message	__class__s      r   r   z!InvalidArgumentException.__init__   s/     

"D2&--ngF )Dr   r	   r
   r   r   r   __classcell__r   s   @r   r   r      s    <
) 
)r   r   c                   "     e Zd ZdZ fdZ xZS )RequiredArgumentExceptionzKAn exception for when a usually optional argument is required in this case.c                 Z    t         t        |   dj                  ||             || _        y )Nz$Missing required argument [{0}]: {1})r   r   r   r   r   r   s      r   r   z"RequiredArgumentException.__init__/   s-    	
#T3.55ngN )Dr   r   r   s   @r   r   r   ,   s    S) )r   r   Nc                 F    |rt        |      S t        | j                        S )zHConvert a google.rpc.Status (used for LRO errors) into a FunctionsError.)r   r   )statuserror_messages     r   StatusToFunctionsErrorr$   6   s    -((		''r   )N)r   
__future__r   r   r   googlecloudsdk.corer   Errorr   r   r   r$   r   r   r   <module>r(      sR    E &  ' *)Z%% ))z// ) )
 0 0 )(r   