VIZ++ Class: UnknownException

 VIZ++ Class Library  VIZ++ Samples  VIZ++ ClassTree 

Source code

/*
 * UnknownException.h 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// 2017/01/29

#pragma once
#include <viz++/Exception.h>

namespace VIZ {

class UnknownException :public Exception {
public:
  UnknownException()
  :Exception(GetLastError(), "Unknown exception.")
  {
  }
//2017/01/23
  virtual void  display(const char* filename, int line, const char* function ) 
  {
    char text[MAX_MESSAGE];
    _snprintf_s(text, sizeof(text), _TRUNCATE, "Caught at %s(%d) %s \r\n\r\n LastError(%d) %s",
        filename, line,  function, 
        getErrorCode(), (const char*)message);
#ifdef WIN32 
    MessageBoxA(NULL, text, "Exception", MB_OK|MB_ICONERROR);
#else
    ::printf("Exception: %s\n", (const char*)text);
#endif
  }
  
//2017/01/23
  virtual void  display(const wchar_t* wfilename, int line, const wchar_t* wfunction ) 
  {
    char text[MAX_MESSAGE];
    const char* filename = toMBString(wfilename);
    const char* function = toMBString(wfunction);
    _snprintf_s(text, sizeof(text), _TRUNCATE, "Caught at %s(%d) %s \r\n\r\n LastError(%d) %s",
      filename, line,  function, 
      getErrorCode(), (const char*)message);
#ifdef WIN32 
    MessageBoxA(NULL, text, "Exception", MB_OK|MB_ICONERROR);
#else
    ::printf("Exception: %s\n", (const char*)text);
#endif
    delete [] filename;
    delete [] function;
  }

};
  
}


Last modified: 10 Feb 2017

Copyright (c) 2009-2017 Antillia.com ALL RIGHTS RESERVED.