o
    rVi                     @   sP   d dl mZ G dd deZG dd deZG dd deZG dd	 d	eZd
S )    )Sequencec                   @      e Zd ZdS )BaseLibp2pErrorN__name__
__module____qualname__ r	   r	   4/Users/sumanjeet/code/py-libp2p/libp2p/exceptions.pyr          r   c                   @   s   e Zd ZdZdS )ValidationErrorz7Raised when something does not pass a validation check.N)r   r   r   __doc__r	   r	   r	   r
   r   
   s    r   c                   @   r   )
ParseErrorNr   r	   r	   r	   r
   r      r   r   c                       s<   e Zd ZdZdee ddf fddZdefddZ  Z	S )	
MultiErroraz  
    A combined error that wraps multiple exceptions into a single error object.
    This error is raised when multiple exceptions need to be reported together,
    typically in scenarios where parallel operations or multiple validations fail.

    Example\:
    ---------
        >>> from libp2p.exceptions import MultiError
        >>> errors = [
        ...     ValueError("Invalid input"),
        ...     TypeError("Wrong type"),
        ...     RuntimeError("Operation failed")
        ... ]
        >>> multi_error = MultiError(errors)
        >>> print(multi_error)
        Error 1: Invalid input
        Error 2: Wrong type
        Error 3: Operation failed

    Note\:
    ------
        The string representation of this error will number and list all contained
        errors sequentially, making it easier to identify individual issues in
        complex error scenarios.

    errorsreturnNc                    s   t  | || _d S )N)super__init__r   )selfr   	__class__r	   r
   r   .   s   
zMultiError.__init__c                 C   s   d dd t| jD S )N
c                 s   s(    | ]\}}d |d  d| V  qdS )zError    z: Nr	   ).0ierrorr	   r	   r
   	<genexpr>3   s    
z%MultiError.__str__.<locals>.<genexpr>)join	enumerater   )r   r	   r	   r
   __str__2   s   
zMultiError.__str__)
r   r   r   r   r   	Exceptionr   strr   __classcell__r	   r	   r   r
   r      s    r   N)collections.abcr   r    r   r   r   r   r	   r	   r	   r
   <module>   s
    