
                         $   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ZdZedz   Zed	z   Z	ej                  r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y)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                   "    e Zd ZdZd Zd Zd Zy)AbortExceptionzGException raised when a user aborts a command that needs to do cleanup.c                 <    t         j                  |        || _        y N)StandardError__init__reason)selfr   s     "platform/gsutil/gslib/exception.pyr   zAbortException.__init__/   s    4 DK    c                      d| j                   z  S NzAbortException: %sr   r   s    r   __repr__zAbortException.__repr__3       $++--r   c                      d| j                   z  S r   r   r   s    r   __str__zAbortException.__str__6   r   r   N__name__
__module____qualname____doc__r   r   r    r   r   r   r   ,   s    O..r   r   c                   $    e Zd ZdZddZd Zd Zy)CommandExceptional  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                 J    t         j                  |        || _        || _        y)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   zCommandException.__init__C   s!     4 DK&Dr   c                     t        |       S r
   strr   s    r   r   zCommandException.__repr__N       t9r   c                      d| j                   z  S )NzCommandException: %sr   r   s    r   r   zCommandException.__str__Q   s    !DKK//r   N)Fr   r   r   r   r    r    :   s    	'0r   r    c                       e Zd ZdZy)ControlCExceptionzException 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.
  Nr   r   r   r   r   r   r   r)   r)   U   s    
 r   r)   c                       e Zd ZdZy)GcloudStorageTranslationErrorzEException raised when a gsutil command can't be translated to gcloud.Nr*   r   r   r   r,   r,   ^   s    Mr   r,   c                       e Zd ZdZy)HashMismatchExceptionz6Exception raised when data integrity validation fails.Nr*   r   r   r   r.   r.   c   s    >r   r.   c                   "    e Zd ZdZd Zd Zd Zy)&IamChOnResourceWithConditionsExceptiona  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                 >    t         j                  | |       || _        y r
   	Exceptionr   messager   r4   s     r   r   z/IamChOnResourceWithConditionsException.__init__z       tW%DLr   c                     t        |       S r
   r$   r   s    r   r   z/IamChOnResourceWithConditionsException.__repr__~   r&   r   c                      d| j                   z  S )Nz*IamChOnResourceWithConditionsException: %sr4   r   s    r   r   z.IamChOnResourceWithConditionsException.__str__   s    7$,,FFr   Nr   r   r   r   r0   r0   h   s    "Gr   r0   c                   "    e Zd ZdZd Zd Zd Zy)InvalidUrlErrorz%Exception raised when URL is invalid.c                 >    t         j                  | |       || _        y r
   r2   r5   s     r   r   zInvalidUrlError.__init__   r6   r   c                     t        |       S r
   r$   r   s    r   r   zInvalidUrlError.__repr__   r&   r   c                      d| j                   z  S )NzInvalidUrlError: %sr9   r   s    r   r   zInvalidUrlError.__str__   s     4<<//r   Nr   r   r   r   r;   r;      s    -0r   r;   c                       e Zd ZdZd Zd Zy)ExternalBinaryErrorzCException raised when gsutil runs an external binary, and it fails.c                 >    t         j                  | |       || _        y r
   r2   r5   s     r   r   zExternalBinaryError.__init__   r6   r   c                      d| j                   z  S )NzExternalBinaryError: %sr9   r   s    r   r   zExternalBinaryError.__repr__   s    $t||33r   N)r   r   r   r   r   r   r   r   r   r@   r@      s    K4r   r@   )r   
__future__r   r   r   r   sixNO_URLS_MATCHED_PREFIXNO_URLS_MATCHED_GENERICNO_URLS_MATCHED_TARGETPY3r3   r   r   r    r)   r,   r.   r0   r;   r@   r   r   r   <module>rI      s   ,
 ' %  ' 
* 1GH /&8 77-.] .0} 06	 I 
I 
GY G:0i 04) 4r   