-#ifdef WIN32
-#include <windows.h>
-#endif
#include <signal.h>
-#include <iostream>
-#include <typeinfo>
-#include <msp/debug/demangle.h>
+#include <msp/io/print.h>
#include "application.h"
#include "getopt.h"
static bool called = false;
if(called)
{
- cerr<<"Trying to call Application::run_app twice!\n";
+ IO::cerr.write("Trying to call Application::run_app twice!\n");
return 125;
}
called = true;
if(!starter_)
{
- cerr<<"Trying to run with no RegisteredApplication class!\n";
+ IO::cerr.write("Trying to run with no RegisteredApplication class!\n");
return 126;
}
}
catch(const usage_error &e)
{
- cerr<<e.what()<<'\n';
- cerr<<e.help()<<'\n';
+ IO::print(IO::cerr, "%s\n%s\n", e.what(), e.help());
return 1;
}
{
delete app_;
-#ifdef WIN32
- string msg = Debug::demangle(typeid(e).name())+":\n"+e.what();
- MessageBoxA(0, msg.c_str(), "Uncaught exception", MB_OK|MB_ICONERROR);
-#else
- cerr<<"An uncaught exception occurred.\n";
- cerr<<" type: "<<Debug::demangle(typeid(e).name())<<'\n';
- cerr<<" what(): "<<e.what()<<'\n';
-#endif
+ display_exception(e);
return 124;
}