void HandleException(ISafeRunnable::Pointer code, const ctkException& e) { try { static_cast<void>(dynamic_cast<const OperationCanceledException&> (e)); } catch (const std::bad_cast&) { // TODO logging try { // Policy.getLog() // .log( // new Status(IStatus.ERROR, Policy.JFACE, // IStatus.ERROR, // "Exception occurred", e)); //$NON-NLS-1$ qDebug() << e.printStackTrace(); } catch (...) { //e.printStackTrace(); BERRY_ERROR << "Exception occurred" << std::endl; } } code->HandleException(e); }
void SafeRunner::HandleException(ISafeRunnable::Pointer code, const ctkException& e) { try { Q_UNUSED(dynamic_cast<const OperationCanceledException&>(e)) } catch (const std::bad_cast& ) { // try to obtain the correct plug-in id for the bundle providing the safe runnable QString pluginId = CTKPluginActivator::getPluginId(static_cast<void*>(code.GetPointer())); if (pluginId.isEmpty()) pluginId = IRuntimeConstants::PI_RUNTIME(); QString message = QString("Problems occurred when invoking code from plug-in: \"%1\".").arg(pluginId); IStatus::Pointer status; try { const CoreException& coreExc = dynamic_cast<const CoreException&>(e); MultiStatus::Pointer multiStatus(new MultiStatus(pluginId, IRuntimeConstants::PLUGIN_ERROR, message, e, BERRY_STATUS_LOC)); multiStatus->Merge(coreExc.GetStatus()); status = multiStatus; } catch (const std::bad_cast&) { IStatus::Pointer tmpStatus(new Status(IStatus::ERROR_TYPE, pluginId, IRuntimeConstants::PLUGIN_ERROR, message, e, BERRY_STATUS_LOC)); status = tmpStatus; } // Make sure user sees the exception: if the log is empty, log the exceptions on stderr // if (!RuntimeLog.isEmpty()) // RuntimeLog.log(status); // else qWarning() << e.printStackTrace(); } code->HandleException(e); }
void WorkbenchPlugin::Log(const ctkException &exc) { QString str; QDebug dbg(&str); dbg << exc.printStackTrace(); BERRY_INFO << "LOG: " << str << std::endl; //inst->GetLog().log(exc); }