File: //proc/thread-self/root/usr/lib/python3.9/site-packages/ipalib/__pycache__/errors.cpython-39.pyc
a
}�fe� � @ s� d Z ddlZddlmZ ddlmZ G dd� de�ZG dd� de�Z G d d
� d
e�Z
G dd� de�ZG d
d� de�ZG dd� de�Z
G dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Zg Zdd� ZG dd� de�ZG dd� de�ZG dd � d e�ZG d!d"� d"e�ZG d#d$� d$e�ZG d%d&� d&e�ZG d'd(� d(e�ZG d)d*� d*e�ZG d+d,� d,e�ZG d-d.� d.e�ZG d/d0� d0e�ZG d1d2� d2e�ZG d3d4� d4e�Z G d5d6� d6e�Z!G d7d8� d8e�Z"G d9d:� d:e"�Z#G d;d<� d<e#�Z$G d=d>� d>e#�Z%G d?d@� d@e#�Z&G dAdB� dBe#�Z'G dCdD� dDe#�Z(G dEdF� dFe#�Z)G dGdH� dHe#�Z*G dIdJ� dJe"�Z+G dKdL� dLe+�Z,G dMdN� dNe,�Z-G dOdP� dPe+�Z.G dQdR� dRe+�Z/G dSdT� dTe�Z0G dUdV� dVe0�Z1G dWdX� dXe�Z2G dYdZ� dZe2�Z3G d[d\� d\e2�Z4G d]d^� d^e2�Z5G d_d`� d`e2�Z6G dadb� dbe2�Z7G dcdd� dde2�Z8G dedf� dfe2�Z9G dgdh� dhe2�Z:G didj� dje2�Z;G dkdl� dle2�Z<G dmdn� dne2�Z=G dodp� dpe2�Z>G dqdr� dre2�Z?G dsdt� dte2�Z@G dudv� dve2�ZAG dwdx� dxe2�ZBG dydz� dze�ZCG d{d|� d|eC�ZDG d}d~� d~eC�ZEG dd�� d�eC�ZFG d�d�� d�eC�ZGG d�d�� d�eC�ZHG d�d�� d�eC�ZIG d�d�� d�eC�ZJG d�d�� d�eC�ZKG d�d�� d�eC�ZLG d�d�� d�eC�ZMG d�d�� d�eC�ZNG d�d�� d�eC�ZOG d�d�� d�eC�ZPG d�d�� d�eC�ZQG d�d�� d�eC�ZRG d�d�� d�eC�ZSG d�d�� d�eC�ZTG d�d�� d�eC�ZUG d�d�� d�eC�ZVG d�d�� d�eC�ZWG d�d�� d�eC�ZXG d�d�� d�eC�ZYG d�d�� d�eC�ZZG d�d�� d�eC�Z[G d�d�� d�eC�Z\G d�d�� d�eC�Z]G d�d�� d�eC�Z^G d�d�� d�eC�Z_G d�d�� d�eC�Z`G d�d�� d�eD�ZaG d�d�� d�eC�ZbG d�d�� d�eC�ZcG d�d�� d�eC�ZdG d�d�� d�eS�ZeG d�d�� d�e]�ZfG d�d d�eC�ZgG d�dĄ d�eC�ZhG d�dƄ d�eC�ZiG d�dȄ d�ei�ZjG d�dʄ d�eC�ZkG d�d̄ d�eC�ZlG d�d΄ d�eC�ZmG d�dЄ d�eC�ZnG d�d҄ d�eC�ZoG d�dԄ d�eC�ZpG d�dք d�eC�ZqG d�d d�eC�ZrG d�dڄ d�eC�ZsG d�d܄ d�eC�ZtG d�dބ d�eC�ZuG d�d� d�en�ZvG d�d� d�en�ZwG d�d� d�eo�ZxG d�d� d�eo�ZyG d�d� d�eo�ZzG d�d� d�eC�Z{G d�d� d�e{�Z|G d�d� d�e{�Z}G d�d� d�eC�Z~G d�d� d�eC�ZG d�d� d�eC�Z�G d�d�� d�eC�Z�G d�d�� d�eC�Z�G d�d�� d�eC�Z�G d�d�� d�eC�Z�G d�d�� d�e{�Z�G d��d � �d eC�Z�G �d�d� �deC�Z�G �d�d� �de��Z�G �d�d� �de��Z�G �d�d� �de��Z�G �d �d
� �d
eC�Z�G �d�d� �de��Z�G �d
�d� �de�Z�e�e�e��e�� e��d�d� �d��Z�e��d�d� e�D ��Z�e��dk�r�e���de�� dS ( a�
Custom exception classes (some which are RPC transparent).
`PrivateError` and its subclasses are custom IPA excetions that will *never* be
forwarded in a Remote Procedure Call (RPC) response.
On the other hand, `PublicError` and its subclasses can be forwarded in an RPC
response. These public errors each carry a unique integer error code as well as
a gettext translated error message (translated at the time the exception is
raised). The purpose of the public errors is to relay information about
*expected* user errors, service availability errors, and so on. They should
*never* be used for *unexpected* programmatic or run-time errors.
For security reasons it is *extremely* important that arbitrary exceptions *not*
be forwarded in an RPC response. Unexpected exceptions can easily contain
compromising information in their error messages. Any time the server catches
any exception that isn't a `PublicError` subclass, it should raise an
`InternalError`, which itself always has the same, static error message (and
therefore cannot be populated with information about the true exception).
The public errors are arranging into five main blocks of error code ranges:
============= ========================================
Error codes Exceptions
============= ========================================
1000 - 1999 `AuthenticationError` and its subclasses
2000 - 2999 `AuthorizationError` and its subclasses
3000 - 3999 `InvocationError` and its subclasses
4000 - 4999 `ExecutionError` and its subclasses
5000 - 5999 `GenericError` and its subclasses
============= ========================================
Within these five blocks some sub-ranges are already allocated for certain types
of error messages, while others are reserved for future use. Here are the
current block assignments:
- **900-5999** `PublicError` and its subclasses
- **901 - 907** Assigned to special top-level public errors
- **908 - 999** *Reserved for future use*
- **1000 - 1999** `AuthenticationError` and its subclasses
- **1001 - 1099** Open for general authentication errors
- **1100 - 1199** `KerberosError` and its subclasses
- **1200 - 1299** `SessionError` and its subclasses
- **1300 - 1999** *Reserved for future use*
- **2000 - 2999** `AuthorizationError` and its subclasses
- **2001 - 2099** Open for general authorization errors
- **2100 - 2199** `ACIError` and its subclasses
- **2200 - 2999** *Reserved for future use*
- **3000 - 3999** `InvocationError` and its subclasses
- **3001 - 3099** Open for general invocation errors
- **3100 - 3199** *Reserved for future use*
- **4000 - 4999** `ExecutionError` and its subclasses
- **4001 - 4099** Open for general execution errors
- **4100 - 4199** `BuiltinError` and its subclasses
- **4200 - 4299** `LDAPError` and its subclasses
- **4300 - 4399** `CertificateError` and its subclasses
- **4400 - 4499** `DNSError` and (some of) its subclasses
- **4500 - 4999** *Reserved for future use*
- **5000 - 5999** `GenericError` and its subclasses
- **5001 - 5099** Open for generic errors
- **5100 - 5999** *Reserved for future use*
� N)�ngettext)�messagesc @ s. e Zd ZdZdZdd� Zejr*edd� �Z dS )�PrivateErrorzR
Base class for exceptions that are *never* forwarded in an RPC response.
� c K sb | j | | _|| _|�� D ]4\}}t| |�rBJ d| jj||f ��t| ||� qt� | | j� d S )Nzconflicting kwarg %s.%s = %r)
�format�msg�kw�items�hasattr� __class__�__name__�setattr� Exception�__init__)�selfr �key�value� r �1/usr/lib/python3.9/site-packages/ipalib/errors.pyr x s
�zPrivateError.__init__c C s t | �S �N��str�r r r r �message� s zPrivateError.messageN)
r �
__module__�__qualname__�__doc__r r �six�PY3�propertyr r r r r r q s
r c @ s e Zd ZdZdZdS )�SubprocessErrora�
Raised when ``subprocess.call()`` returns a non-zero exit status.
This custom exception is needed because Python 2.4 doesn't have the
``subprocess.CalledProcessError`` exception (which was added in Python 2.5).
For example:
>>> raise SubprocessError(returncode=2, argv=('ls', '-lh', '/no-foo/'))
Traceback (most recent call last):
...
SubprocessError: return code 2 from ('ls', '-lh', '/no-foo/')
The exit code of the sub-process is available via the ``returncode``
instance attribute. For example:
>>> e = SubprocessError(returncode=1, argv=('/bin/false',))
>>> e.returncode
1
>>> e.argv # argv is also available
('/bin/false',)
z(return code %(returncode)d from %(argv)rN�r r r r r r r r r r � s r c @ s e Zd ZdZdZdS )�PluginSubclassErrora"
Raised when a plugin doesn't subclass from an allowed base.
For example:
>>> raise PluginSubclassError(plugin='bad', bases=('base1', 'base2'))
Traceback (most recent call last):
...
PluginSubclassError: 'bad' not subclass of any base in ('base1', 'base2')
z0%(plugin)r not subclass of any base in %(bases)rNr! r r r r r"