Namespace sh::exceptionsΒΆ

namespace sh::exceptions

Exceptions.

The class hierarchy of Shallot exceptions as well as some utilities for exception handling.

Enums

enum ExecuteGuardFlag

Values:

enumerator MANUAL_RETRY_ENABLED = 1 << 0
enumerator AUTOMATIC_RETRY_ENABLED = 1 << 1
enumerator LOGGING_DISABLED = 1 << 2
enumerator RESUMEABLE_PROGRAM_ERROR_END_WITH_USER_FEEDBACK_HERE = 1 << 3
enumerator CANCELABLE_UP_TO_HERE = 1 << 4
enumerator ALL_ERRORS_KILL_SHALLOT = 1 << 5
enumerator IGNORE_ALL_RESUMEABLE_ERRORS_SILENTLY = 1 << 6
class ArgumentException : public sh::exceptions::ProgramException
#include <argumentexception.h>

Shallot exception for failed operation due to invalid arguments given to some program part. It typically allows resume but not retry (special cases may override each of them).

Subclassed by sh::filesystem::EurlMisformattedException

Public Functions

ArgumentException(ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"
class CancelException
#include <exception.h>

A special exception for cancellation of some action on user behalf.

A very special exception outside of the hierarchy. It is only used by the infrastructure; never throw it directly.

Public Functions

CancelException()
class Exception
#include <exception.h>

Shallot exception base class. Also contains some static methods for general work with exceptions.

Subclassed by sh::exceptions::ProgramException, sh::exceptions::RuntimeException, sh::scripting::ScriptingEngine::ScriptedException

Public Functions

QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
Exception(ExceptionData data)
Exception()
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"

Private Static Functions

void exceptionDialog(QString error1, QString error2, QString details, QString icon, bool mayRetry, bool mayClose, bool mayCancel, bool showLoglabelAndDetails, bool *doRetry)

Private Static Attributes

bool _inShutdown = false
QMutex _inShutdownMutex
class HandlerSettings
#include <exception.h>

Public Members

QString cancelText
QStack<std::function<bool(sh::exceptions::Exception&)>> exceptionHandler_retryable
QStack<std::function<void(sh::exceptions::Exception&)>> exceptionHandler_resumeable
QStack<std::function<void(sh::exceptions::Exception&)>> exceptionHandler_hard
QStack<std::function<void()>> exceptionHandler_cancel

Private Functions

HandlerSettings()

Friends

friend class ExceptionHandlerSettingsManager
template<class Handler>
class RegisterHandler
#include <exception.h>

Public Functions

RegisterHandler(Handler handler, QStack<Handler> *stack)
~RegisterHandler()

Private Members

QStack<Handler> *_stack
class ExceptionData : public QMap<QString, QString>
#include <exception.h>

Used for specifying metadata for a sh::exceptions::Exception.

Public Functions

ExceptionData(const ExceptionData &o)
ExceptionData(const QMap<QString, QString> &o)
ExceptionData()
ExceptionData name(QString name)
ExceptionData classes(QString classes)
ExceptionData aux(QString aux)
ExceptionData details(QString details)
ExceptionData message(QString message)
ExceptionData runtime()
ExceptionData program()
ExceptionData retryable(bool v = true)
ExceptionData resumeable(bool v = true)
ExceptionData autoRetryRecommended(int v = -1)
ExceptionData detailsAreInteresting(bool v = true)
class ExceptionHandlerSettingsManager : public sh::base::Singleton
#include <exception.h>

Managing how to default-handle unhandled exceptions.

Public Functions

Exception::HandlerSettings *handlerSettings()

Returns the current Exception::HandlerSettings.

~ExceptionHandlerSettingsManager()
void doInitialize()

Executes singleton initialization.

void doShutdown()

Executes singleton shutdown.

void shutdown()

Shutdown down this singleton.

bool isAlive()

Returns if this singleton is alive (true until its shutdown begins).

Private Functions

ExceptionHandlerSettingsManager()

Private Members

QMap<QThread*, Exception::HandlerSettings*> _handlerSettings
QMutex _mutex
class IOException : public sh::exceptions::RuntimeException
#include <ioexception.h>

Shallot exception in IO. It allows resume and typically allows retry (special cases may override each of them).

Subclassed by sh::exceptions::PermissionDeniedException, sh::filesystem::Operation::MaxAllowedSizeRatioPerPartExceededException

Public Functions

IOException(ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"
class PermissionDeniedException : public sh::exceptions::IOException
#include <permissiondeniedexception.h>

Shallot exception for something forbidden was tried to execute. It allows resume and retry (special cases may override each of them).

Public Functions

PermissionDeniedException(ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"
class ProgramException : public sh::exceptions::Exception
#include <programexception.h>

Shallot exception for internal bugs in Shallot. It optionally allows resume but no retry (special cases may override each of them).

Subclassed by sh::exceptions::ArgumentException, sh::exceptions::ThreadingException

Public Functions

ProgramException(ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"
class RuntimeException : public sh::exceptions::Exception
#include <runtimeexception.h>

Shallot exception for failed operation due to (often external) runtime effects. It allows resume and optionally allows retry (special cases may override each of them).

Subclassed by sh::exceptions::IOException

Public Functions

RuntimeException(ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"
class ThreadAbortException
#include <exception.h>

Only used by the infrastructure; never throw it directly.

Public Functions

ThreadAbortException()
class ThreadingException : public sh::exceptions::ProgramException
#include <threadingexception.h>

Shallot exception for misuse of threading (e.g. wrong caller thread). It does not allow resume (special cases may override each of them).

Public Functions

ThreadingException(ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"