ErrorInfo.cpp revision a126a5a0d184e3245a585414758011d1d095b35f
/* $Id$ */
/** @file
*
* ErrorInfo class definition
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#if !defined (VBOX_WITH_XPCOM)
#else
#include <nsIServiceManager.h>
#include <nsIExceptionService.h>
#include <nsCOMPtr.h>
#endif
#include "VBox/com/VirtualBox.h"
#include "VBox/com/ErrorInfo.h"
namespace com
{
// ErrorInfo class
////////////////////////////////////////////////////////////////////////////////
{
#if !defined (VBOX_WITH_XPCOM)
{
if (aKeepObj)
mErrorInfo = err;
if (!mIsFullAvailable)
{
bool gotSomething = false;
if (gotSomething)
mIsBasicAvailable = true;
}
}
#else // defined (VBOX_WITH_XPCOM)
if (NS_SUCCEEDED(rc))
{
if (NS_SUCCEEDED(rc))
{
{
if (aKeepObj)
mErrorInfo = ex;
if (!mIsFullAvailable)
{
bool gotSomething = false;
char *pszMsg;
if (NS_SUCCEEDED(rc))
{
}
if (gotSomething)
mIsBasicAvailable = true;
}
// set the exception to NULL (to emulate Win32 behavior)
}
}
}
/* Ignore failure when called after nsComponentManagerImpl::Shutdown(). */
else if (rc == NS_ERROR_UNEXPECTED)
AssertComRC (rc);
#endif // defined (VBOX_WITH_XPCOM)
}
bool aKeepObj /* = false */)
{
if (!aI)
return;
#if !defined (VBOX_WITH_XPCOM)
{
}
#else
#endif
if (mIsBasicAvailable)
{
mCalleeIID = aIID;
}
}
{
bool gotSomething = false;
bool gotAll = true;
{
mInterfaceID = iid;
}
if (m_pNext)
{
delete m_pNext;
}
{
if (!m_pNext)
rc = E_OUTOFMEMORY;
}
}
{
if (m_pNext)
{
delete m_pNext;
}
}
// ProgressErrorInfo class
////////////////////////////////////////////////////////////////////////////////
ErrorInfo (false /* aDummy */)
{
if (!progress)
return;
}
// ErrorInfoKeeper class
////////////////////////////////////////////////////////////////////////////////
{
if (mForgot)
return S_OK;
#if !defined (VBOX_WITH_XPCOM)
if (!mErrorInfo.isNull())
{
AssertComRC (rc);
}
#else // !defined (VBOX_WITH_XPCOM)
if (NS_SUCCEEDED(rc))
{
if (NS_SUCCEEDED(rc))
{
if (!mErrorInfo.isNull())
{
AssertComRC (rc);
}
}
}
#endif // !defined (VBOX_WITH_XPCOM)
{
mForgot = true;
}
return rc;
}
} /* namespace com */