diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-18 02:46:00 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-18 02:46:00 +0200 |
commit | 0531bf802017b7792b90270b6346b3c88ffcea70 (patch) | |
tree | ae97ab4769817ab5ee7014559f7a975a04c8b30e /c/main.cpp | |
parent | 1934d2cfc40bd9ef88c83decb970bbccc4914a15 (diff) | |
download | EpisodeBrowser-0531bf802017b7792b90270b6346b3c88ffcea70.tar.gz |
Improve exception message.
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -51,14 +51,18 @@ void OnTerminate() try { std::rethrow_exception(std::current_exception()); } catch (const term_t& t) { + std::basic_string<TCHAR> tstr = TEXT("The program was terminated due to a Prolog exception: "); TCHAR* tsz; if (PL_get_tchars(t, &tsz, CVT_WRITE)) { - MessageBox(NULL, tsz, TEXT("Fatal Error"), MB_ICONERROR); + tstr += tsz; + MessageBox(NULL, tstr.c_str(), TEXT("Fatal Error"), MB_ICONERROR); } else MessageBoxA(NULL, "The program was terminated due to a Prolog exception.", "Fatal Error", MB_ICONERROR); } catch (std::exception& e) { - MessageBoxA(NULL, e.what(), "Fatal Error", MB_ICONERROR); + std::string str = "The program was terminated due to an exception: "; + str += e.what(); + MessageBoxA(NULL, str.c_str(), "Fatal Error", MB_ICONERROR); } catch (...) { MessageBoxA(NULL, "The program was terminated due to an exception.", "Fatal Error", MB_ICONERROR); |