Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

  1. // Error.h: interface for the CError class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_ERROR_H__0E27E3A0_FD59_11D0_A435_00C04FB99B01__INCLUDED_)
  5. #define AFX_ERROR_H__0E27E3A0_FD59_11D0_A435_00C04FB99B01__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. class CError
  10. {
  11. public:
  12. static void ErrorMsgBox(HRESULT hr);
  13. static void ErrorTrace(HRESULT hr,LPCSTR szStr,LPCSTR szFile,int iLine);
  14. static void Trace(LPCSTR szStr);
  15. static void Trace(LPCTSTR szStr);
  16. CError();
  17. virtual ~CError();
  18. };
  19. // @todo make these macros log the errors
  20. #define FAIL_RPT1(hr,str) CError::ErrorTrace(hr,str,__FILE__,__LINE__)
  21. #define FAIL_RTN1(hr,str) { FAIL_RPT1(hr,str); return hr;}
  22. #define IF_FAIL_RTN(hr) if(FAILED(hr)) { FAIL_RTN1(hr,L""); return hr; }
  23. #define IF_FAIL_RTN1(hr,str) if(FAILED(hr)) { FAIL_RTN1(hr,str); return hr; }
  24. #define IF_FAIL_RPT1(hr,str) if(FAILED(hr)) { FAIL_RPT1(hr,str); };
  25. #endif // !defined(AFX_ERROR_H__0E27E3A0_FD59_11D0_A435_00C04FB99B01__INCLUDED_)