a oeO%@sdZddlZddlZddlZddlZddlZddlZddlZddl m Z dZ ddZ ddZ dd ZGd d d ZGd d d ejjjZddZdS)zException and error handling. This contains the core exceptions that the implementations should raise as well as the IActiveScriptError interface code. N)axscriptcCs tt|S)z'Format a string suitable for an AX Host) ExpandTabsAddCRtextrBC:\Program Files\Certbot\pkgs\win32comext\axscript\client\error.py FormatForAXsr cCstdd|S)N z resubrrrrrsrcCstdd|S)N z r rrrrrsrc@sHeZdZdZejgZgdZddZddZ ddZ d d Z d d Z d S)IActiveScriptErrorzAn implementation of IActiveScriptError The ActiveX Scripting host calls this client whenever we report an exception to it. This interface provides the exception details for the host to report to the user. )GetSourceLineTextGetSourcePositionGetExceptionInfocCstd|dS)Nz#IActiveScriptError QI - unknown IIDr)print)selfZiidrrr_query_interface_.s z$IActiveScriptError._query_interface_cCs ||_dSN exception)rexcrrr_SetExceptionInfo2sz$IActiveScriptError._SetExceptionInfocCs|jjSr)rlinetextrrrrr5sz$IActiveScriptError.GetSourceLineTextcCs&|jj}||jj|jjd|jjfS)N)r sourceContextlineno startLineNocolno)rctxrrrr8s z$IActiveScriptError.GetSourcePositioncCs|jSrrrrrrrAsz#IActiveScriptError.GetExceptionInfoN) __name__ __module__ __qualname____doc__rIID_IActiveScriptErrorZ_com_interfaces_Z_public_methods_rrrrrrrrrr#s rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)AXScriptExceptionzA class used as a COM exception. Note this has attributes which conform to the standard attributes for COM exceptions, plus a few others specific to our IActiveScriptError object. cCsZtjjjj|dtjdd|dur0d|_d|_n|j |_|j |_d|_ | ||||dS)NzUnknown ExceptionzPython ActiveX Scripting Engine) descriptionscodesourcer) win32comserverr COMException__init__winerrorDISP_E_EXCEPTIONrr ZsourceContextCookieZstartLineNumberr&_AXScriptException__BuildFromException)rsite codeBlockexc_type exc_value exc_tracebackrrrr0Ms zAXScriptException.__init__cCs^trddl}|z.t|tr0||||n|||||WntYn0dSNr) debugging linecache clearcache issubclass SyntaxError_BuildFromSyntaxError_BuildFromOther traceback print_exc)rr4typevaluetbr;rrrZ__BuildFromExceptionas z&AXScriptException.__BuildFromExceptionc Cs|j}z |d}Wnd|f}Yn0z,|d\}}}} |durHd}| durTd} Wnd}d}d}d} Yn0t||_||_|d|_t| |_dS)NrzUnknown Error (%s)rr,ZUnknown)argsr r)rr!rrstripr) rr4rrErDmsgfilenameroffsetlinerrrr?ps(    z'AXScriptException._BuildFromSyntaxErrorcCsd|_d|_tr2t|||}td||_dSgd}d}|}|rt|||\} } } } | dddkrlqt|j }qBg} |rd}|}|r|||\} } } } | |vrq| dr| |_| |_ | | | | | f|d}|j }qnd}|}dg}| t| |tjkrVd |j|jf}|jtjkrF|jrF|jd rF|jd }| d |n| t||tjd krtt|D]*}t||tur||d ||<qtd||_d}}}dS)Nrr,)Zr_importZr_reloadZr_openzs  ",