-/*
+/* $Id$
+
This file is part of libmspcore
Copyright © 2006 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
#include <signal.h>
#include <iostream>
#include "../time/units.h"
+#include "../time/utils.h"
#include "application.h"
#include "error.h"
return 1;
}
- int result=app_->main();
- delete app_;
- return result;
+ try
+ {
+ int result=app_->main();
+ delete app_;
+ return result;
+ }
+ catch(const exception &e)
+ {
+ cerr<<"An uncaught exception occurred.\n";
+ cerr<<" type: "<<typeid(e).name()<<'\n';
+ cerr<<" what(): "<<e.what()<<'\n';
+ delete app_;
+ throw;
+ }
}
/**
void Application::usage(const char *reason, const char *, bool)
{
if(reason)
- cerr<<reason<<'\n';
+ cerr<<"UsageError: "<<reason<<'\n';
cerr<<"The programmer was lazy and didn't write a usage() function for this application.\n";
}
else if(loop_mode_==TICK_SLEEP)
{
tick();
- sleep(Time::msec);
+ Time::sleep(Time::msec);
}
else if(loop_mode_==TICK_YIELD)
{