23 bool SafeRunnable::ignoreErrors =
false;
26 class DefaultSafeRunnableRunner:
public ISafeRunnableRunner
36 catch (
const ctkException& e)
38 HandleException(code, e);
40 catch (
const std::exception& e)
42 HandleException(code, e);
46 HandleException(code);
54 HandleException(code, ctkException(
"Unknown exception thrown"));
58 const std::exception& e)
60 HandleException(code, ctkException(e.what()));
67 static_cast<void>(
dynamic_cast<const OperationCanceledException&
> (e));
69 catch (
const std::bad_cast&)
79 qDebug() << e.printStackTrace();
87 code->HandleException(e);
91 SmartPointer<ISafeRunnableRunner> SafeRunnable::CreateDefaultRunner()
110 if (message.isEmpty())
111 message =
"An error has occurred. See error log for more details.";
134 runner = CreateDefaultRunner();
141 SafeRunnable::runner = runner;
static bool GetIgnoreErrors()
berry::SmartPointer< Self > Pointer
static ISafeRunnableRunner::Pointer GetRunner()
Implements transparent reference counting.
static void SetIgnoreErrors(bool flag)
berry::SmartPointer< Self > Pointer
SafeRunnable(const QString &message="")
void Run(berry::IWorkbenchPartSite::Pointer workbenchPartSite, mitk::DataStorage::Pointer dataStorage)
static void SetRunner(ISafeRunnableRunner::Pointer runner)
void HandleException(const ctkException &e) override