< prev index next >

src/jdk.jpackage/windows/native/libjpackage/WinErrorHandling.h

Print this page




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 #ifndef WinErrorHandling_h
  28 #define WinErrorHandling_h
  29 
  30 
  31 #include "ErrorHandling.h"
  32 
  33 
  34 class SysError : public std::runtime_error {
  35 public:
  36     SysError(const tstrings::any& msg, const void* caller,
  37             DWORD errorCode=GetLastError(), const char* label="System error");
  38 
  39     // returns string "system error <errCode> (error_description)"
  40     // in UNICODE is not defined, the string returned is utf8-encoded
  41     static std::wstring getSysErrorMessage(DWORD errCode = GetLastError(), HMODULE moduleHandle = NULL);

  42     
  43     // returns string "COM error 0x<hr> (error_description)"
  44     // in UNICODE is not defined, the string returned is utf8-encoded
  45     static std::wstring getComErrorMessage(HRESULT hr);
  46 };
  47 
  48 #endif // #ifndef WinErrorHandling_h


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 #ifndef WinErrorHandling_h
  28 #define WinErrorHandling_h
  29 
  30 
  31 #include "ErrorHandling.h"
  32 
  33 
  34 class SysError : public std::runtime_error {
  35 public:
  36     SysError(const tstrings::any& msg, const void* caller,
  37             DWORD errorCode=GetLastError(), const char* label="System error");
  38 
  39     // returns string "system error <errCode> (error_description)"
  40     // in UNICODE is not defined, the string returned is utf8-encoded
  41     static std::wstring getSysErrorMessage(DWORD errCode = GetLastError(),
  42             HMODULE moduleHandle = NULL);
  43 
  44     // returns string "COM error 0x<hr> (error_description)"
  45     // in UNICODE is not defined, the string returned is utf8-encoded
  46     static std::wstring getComErrorMessage(HRESULT hr);
  47 };
  48 
  49 #endif // #ifndef WinErrorHandling_h
< prev index next >