Use the BApplication constructor that returns an error code instead of the one that just exit()s on error, so that we can at least print the error.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10728 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-01-14 15:33:57 +00:00
parent 2397da28a0
commit dca399f444
2 changed files with 20 additions and 4 deletions

View File

@ -2,6 +2,9 @@
#include "Debug.h"
#include <stdio.h>
#include <string.h>
#include <Application.h>
#include <Message.h>
#include <OS.h>
@ -31,9 +34,11 @@ static const bigtime_t kRosterSanityEventInterval = 1000000LL;
// constructor
/*! \brief Creates the registrar application class.
\param error Passed to the BApplication constructor for returning an
error code.
*/
Registrar::Registrar()
: BApplication(kRegistrarSignature),
Registrar::Registrar(status_t *error)
: BApplication(kRegistrarSignature, error),
fRoster(NULL),
fClipboardHandler(NULL),
fMIMEManager(NULL),
@ -272,14 +277,25 @@ int
main()
{
FUNCTION_START();
// rename the main thread
rename_thread(find_thread(NULL), kRosterThreadName);
// create and run the registrar application
Registrar *app = new Registrar();
status_t error;
Registrar *app = new Registrar(&error);
if (error != B_OK) {
fprintf(stderr, "Failed to create the BApplication: %s\n",
strerror(error));
return 1;
}
PRINT(("app->Run()...\n"));
app->Run();
PRINT(("delete app...\n"));
delete app;
FUNCTION_END();
return 0;
}

View File

@ -41,7 +41,7 @@ namespace BPrivate {
class Registrar : public BApplication {
public:
Registrar();
Registrar(status_t *error);
virtual ~Registrar();
virtual void MessageReceived(BMessage *message);