Handles detailed IM_ERROR messages.

This commit is contained in:
plfiorini 2010-05-30 20:50:26 +00:00
parent 5ddeef6e7b
commit 183a682585

View File

@ -189,8 +189,19 @@ MainWindow::MessageReceived(BMessage* message)
void void
MainWindow::ImError(BMessage* msg) MainWindow::ImError(BMessage* msg)
{ {
// FIXME: better error handling.. const char* error = NULL;
BAlert* alert = new BAlert("Error", msg->FindString("error"), "Ouch!"); const char* detail = msg->FindString("detail");
if (msg->FindString("error", &error) != B_OK)
return;
// Format error message
BString errMsg(error);
if (detail)
errMsg << "\n" << detail;
BAlert* alert = new BAlert("Error", errMsg.String(), "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(); alert->Go();
} }