Repository URL to install this package:
|
Version:
4.2.64.2-4.2 ▾
|
python3-dmapi
/
usr
/
lib
/
python3.6
/
site-packages
/
dmapi
/
__pycache__
/
exception_wrapper.cpython-36.pyc
|
|---|
3
[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.6/exception_wrapper.pyÚ_emit_exception_notification s
r c C sR t jj|}tjtj|d}tjdtj j
d}t j||tjj
|d}|j| d S )N)Úhostr Zcompute)ÚobjectÚaction)Ú publisherÚ
event_typeZpriorityÚ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}| j||| 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 j |S )Nc s y| |f||S t k
r } zTtj @ s6rht| |f||}j}tpZ |||| W d Q R X W Y d d }~X nX d S )N)Ú 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&