ó
¢¿[Mc           @   sY   d  Z  d d l Z d d l Z d e j f d „  ƒ  YZ e Z d d „ Z d d „ Z d S(   sÐ  Exception Handling

 Exceptions

	 To better support COM exceptions, the framework allows for an instance to be
	 raised.  This instance may have a certain number of known attributes, which are
	 translated into COM exception details.
	
	 This means, for example, that Python could raise a COM exception that includes details
	 on a Help file and location, and a description for the user.
	
	 This module provides a class which provides the necessary attributes.

iÿÿÿÿNt   COMExceptionc           B   s5   e  Z d  Z d d d d d d d d „ Z d „  Z RS(   sÊ  An Exception object that is understood by the framework.
	
	If the framework is presented with an exception of type class,
	it looks for certain known attributes on this class to provide rich
	error information to the caller.

	It should be noted that the framework supports providing this error
	information via COM Exceptions, or via the ISupportErrorInfo interface.

	By using this class, you automatically provide rich error information to the
	server.
	c         C   sç   | p	 | } | rJ | d k rJ | d k rJ | d k  rJ d | d @B} qJ n  | |  _  | p\ | |  _ | d k r„ |  j r„ d |  _ n% | r© |  j r© t j | ƒ |  _ n  | |  _ | |  _ | |  _ t j j |  | |  j d d ƒ d S(	   s  Initialize an exception
		**Params**

		description -- A string description for the exception.
		scode -- An integer scode to be returned to the server, if necessary.
		The pythoncom framework defaults this to be DISP_E_EXCEPTION if not specified otherwise.
		source -- A string which identifies the source of the error.
		helpfile -- A string which points to a help file which contains details on the error.
		helpContext -- An integer context in the help file.
		desc -- A short-cut for description.
		hresult -- A short-cut for scode.
		i   i €ÿÿi €  i  €iÿÿ  t   S_FALSEiÿÿÿÿN(
   t   scodet   descriptiont	   pythoncomt   GetScodeStringt   sourcet   helpfilet   helpcontextt	   com_errort   __init__t   None(   t   selfR   R   R   R   t   helpContextt   desct   hresult(    (    s<   K:\RCS\Python\Lib\site-packages\win32com\server\exception.pyR
       s    				c         C   s   d |  j  |  j f S(   Ns#   <COM Exception - scode=%s, desc=%s>(   R   R   (   R   (    (    s<   K:\RCS\Python\Lib\site-packages\win32com\server\exception.pyt   __repr__E   s    N(   t   __name__t
   __module__t   __doc__R   R
   R   (    (    (    s<   K:\RCS\Python\Lib\site-packages\win32com\server\exception.pyR       s
   	#c         C   sU   |  d  k r t j ƒ  d }  n  y t |  t j ƒ SWn t k
 rP |  t j k SXd  S(   Ni    (   R   t   syst   exc_infot
   issubclassR   R	   t	   TypeErrort	   pythoncon(   t   t(    (    s<   K:\RCS\Python\Lib\site-packages\win32com\server\exception.pyt   IsCOMExceptionM   s    c         C   sI   |  d  k r t j ƒ  d }  n  y t |  t ƒ SWn t k
 rD d SXd  S(   Ni    (   R   R   R   R   R    R   (   R   (    (    s<   K:\RCS\Python\Lib\site-packages\win32com\server\exception.pyt   IsCOMServerExceptionU   s    (	   R   R   R   R	   R    t	   ExceptionR   R   R   (    (    (    s<   K:\RCS\Python\Lib\site-packages\win32com\server\exception.pyt   <module>   s
   8