Repository URL to install this package:
| 
      
        
        
        Version: 
        
         
          
          4.2.64.2-4.2  ▾
        
         | 
| 
    
    python3-dmapi-el9
  
    /
        
    usr
  
        /
        
    lib
  
        /
        
    python3.9
  
        /
        
    site-packages
  
        /
        
    dmapi
  
        /
        
    __pycache__
  
        /
        exception_wrapper.cpython-39.pyc
   | 
|---|
a
    Տ[d  ã                   @   s¤   d dl Z d dlZd dlmZ d dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ ej
jZdd	 Zejd
d Zdd
 ZdddZdd Zdd ZdS )é    N)Úexcutils)Úbase)Ú	exception)Úfields)Úrpc)Ú
safe_utilsc                 C   s    t | |||| t||| d S ©N)Ú#_emit_legacy_exception_notificationÚ&_emit_versioned_exception_notification)ÚnotifierÚcontextÚexÚ
function_nameÚargsÚsource© r   ú;/usr/lib/python3.9/site-packages/dmapi/exception_wrapper.pyÚ_emit_exception_notification   s    
ÿr   c                 C   sR   t j |¡}tjtj|d}tjdtj	j
d}t j||tjj
|d}| | ¡ d S )N)Úhostr   Zcompute)ÚobjectÚaction)Ú	publisherÚ
event_typeÚpriorityÚpayload)r   ZExceptionPayloadÚfrom_exceptionr   ZNotificationPublisherÚCONFr   Z	EventTyper   ZNotificationActionZ	EXCEPTIONZExceptionNotificationZNotificationPriorityZERRORÚemit)r   r
   r   Zversioned_exception_payloadr   r   Znotificationr   r   r   r
      s    þür
   c                 C   s   t ||d}|  |||¡ d S )N)r   r   )ÚdictÚerror)r   r   r
   r   r   r   r   r   r   r	   *   s    r	   c                    s    fdd}|S )zThis decorator wraps a method to catch any exceptions that may
    get thrown. It also optionally sends the exception to the notification
    system.
    c                    s     fdd}t   ¡|S )Nc                    s¬   z| |g|¢R i |¤W S  t y¦ } ztt ¡ P s<rtt| |g|¢R i |¤}j}tpf ||||  W d    n1 s0    Y  W Y d }~n
d }~0 0 d S r   )Ú	Exceptionr   Zsave_and_reraise_exceptionÚ_get_call_dictÚ__name__r   )Úselfr   r   ÚkwÚeÚ	call_dictr   )ÚbinaryÚfÚget_notifierr   r   r   Úwrapped6   s"    
ÿÿÿþz.wrap_exception.<locals>.inner.<locals>.wrapped)Ú	functoolsÚwraps)r(   r*   ©r'   r)   r   )r(   r   Úinner5   s    zwrap_exception.<locals>.innerr   )r   r)   r'   r.   r   r-   r   Úwrap_exception0   s    r/   c                 O   sF   t  | ¡}tj|||g|¢R i |¤}| dd ¡ | dd ¡ t|S )Nr#   r   )r   Zget_wrapped_functionÚinspectZgetcallargsÚpopÚ
_cleanse_dict)Úfunctionr#   r   r   r$   Zwrapped_funcr&