
                         .   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKrSr\S-   r\S	-   r	\R                  (       a  \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g)zagsutil exceptions.

The exceptions in this module are for use across multiple different classes.
    )absolute_import)print_function)division)unicode_literalsNzNo URLs matchedz). Do the files you're operating on exist?z: %sc                   *    \ rS rSrSrS rS rS rSrg)AbortException,   zGException raised when a user aborts a command that needs to do cleanup.c                 :    [         R                  U 5        Xl        g N)StandardError__init__reason)selfr   s     "platform/gsutil/gslib/exception.pyr   AbortException.__init__/   s    4 K    c                      SU R                   -  $ NzAbortException: %sr   r   s    r   __repr__AbortException.__repr__3       $++--r   c                      SU R                   -  $ r   r   r   s    r   __str__AbortException.__str__6   r   r   r   N	__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__ r   r   r   r   ,   s    O..r   r   c                   .    \ rS rSrSrSS jrS rS rSrg)	CommandException:   ab  Exception raised when a problem is encountered running a gsutil command.

This exception should be used to signal user errors or system failures
(like timeouts), not bugs (like an incorrect param value). For the
latter you should raise Exception so we can see where/how it happened
via gsutil -D (which will include a stack trace for raised Exceptions).
c                 F    [         R                  U 5        Xl        X l        g)zInstantiate a CommandException.

Args:
  reason: Text describing the problem.
  informational: Indicates reason should be printed as FYI, not a failure.
N)r   r   r   informational)r   r   r)   s      r   r   CommandException.__init__C   s     4 K&r   c                     [        U 5      $ r   strr   s    r   r   CommandException.__repr__N       t9r   c                      SU R                   -  $ )NzCommandException: %sr   r   s    r   r   CommandException.__str__Q   s    !DKK//r   )r)   r   N)Fr   r$   r   r   r&   r&   :   s    	'0r   r&   c                       \ rS rSrSrSrg)ControlCExceptionU   zException to report to analytics when the user exits via ctrl-C.

This exception is never actually raised, but is used by analytics collection
to provide a more descriptive name for user exit.
r$   Nr   r   r    r!   r"   r#   r$   r   r   r3   r3   U   s    
 r   r3   c                       \ rS rSrSrSrg)GcloudStorageTranslationError^   zEException raised when a gsutil command can't be translated to gcloud.r$   Nr5   r$   r   r   r7   r7   ^   s    Mr   r7   c                       \ rS rSrSrSrg)HashMismatchExceptionc   z6Exception raised when data integrity validation fails.r$   Nr5   r$   r   r   r:   r:   c   s    >r   r:   c                   *    \ rS rSrSrS rS rS rSrg)&IamChOnResourceWithConditionsExceptionh   a  Raised when trying to use "iam ch" on an IAM policy with conditions.

Because the syntax for conditions is fairly complex, it doesn't make sense to
specify them on the command line using a colon-delimited set of values in the
same way you'd specify simple bindings - it would be a complex and potentially
surprising interface, which isn't what you want when dealing with permissions.

Additionally, providing partial functionality -- e.g. if a policy contains
bindings with conditions, still allow users to interact with bindings that
don't contain conditions -- might sound tempting, but results in a bad user
experience. Bindings can be thought of as a mapping from (role, condition) ->
[members]. Thus, a user might think they're editing the binding for (role1,
condition1), but they'd really be editing the binding for (role1, None). Thus,
we just raise an error if we encounter a binding with conditions present, and
encourage users to use "iam {get,set}" instead.
c                 :    [         R                  X5        Xl        g r   	Exceptionr   messager   rB   s     r   r   /IamChOnResourceWithConditionsException.__init__z       t%Lr   c                     [        U 5      $ r   r,   r   s    r   r   /IamChOnResourceWithConditionsException.__repr__~   r/   r   c                      SU R                   -  $ )Nz*IamChOnResourceWithConditionsException: %srB   r   s    r   r   .IamChOnResourceWithConditionsException.__str__   s    7$,,FFr   rI   Nr   r$   r   r   r=   r=   h   s    "Gr   r=   c                   *    \ rS rSrSrS rS rS rSrg)InvalidUrlError   z%Exception raised when URL is invalid.c                 :    [         R                  X5        Xl        g r   r@   rC   s     r   r   InvalidUrlError.__init__   rE   r   c                     [        U 5      $ r   r,   r   s    r   r   InvalidUrlError.__repr__   r/   r   c                      SU R                   -  $ )NzInvalidUrlError: %srI   r   s    r   r   InvalidUrlError.__str__   s     4<<//r   rI   Nr   r$   r   r   rL   rL      s    -0r   rL   c                   $    \ rS rSrSrS rS rSrg)ExternalBinaryError   zCException raised when gsutil runs an external binary, and it fails.c                 :    [         R                  X5        Xl        g r   r@   rC   s     r   r   ExternalBinaryError.__init__   rE   r   c                      SU R                   -  $ )NzExternalBinaryError: %srI   r   s    r   r   ExternalBinaryError.__repr__   s    $t||33r   rI   N)r   r   r    r!   r"   r   r   r#   r$   r   r   rU   rU      s    K4r   rU   )r"   
__future__r   r   r   r   sixNO_URLS_MATCHED_PREFIXNO_URLS_MATCHED_GENERICNO_URLS_MATCHED_TARGETPY3rA   r   r   r&   r3   r7   r:   r=   rL   rU   r$   r   r   <module>ra      s   ,
 ' %  ' 
* 1GH /&8 77-.] .0} 06	 I 
I 
GY G:0i 04) 4r   