Tools to help manage various problems in command-line or Emscripten-based applications.

There are three possible recipiants for all errors/warnings.

  • The end-user if the problem stems from inputs they provided to the executable.

  • The library user if the problem is due to mis-use of library functionality.

  • The library developers if something that should be impossible occurs.

There are also three types of problmes to notify about:

  • Warnings if something looks suspicious, but isn’t technically a problem.

  • Errors if something has gone so horribly wrong that it is impossible to recover from.

  • Exceptions if something didn’t go the way we expected, but we can still recover.

In general, most of the content of this file is targeted at providing useful tools for library users; end-users should receive more customized messages and asserts should capture suposedly “impossible” situations that none-the-less occur in the library itself.


  • Whenever possible, exceptions should be preferred. They are more specific than warnings, but don’t halt execution like errors.

  • Warnings should always detail what should be done differently to surpress the warning.


    We should move over to a pure replacement for exceptions.

    • Different types of exceptions can trigger a signal. Actions should return a bool indicating whether the exception was fixed.

    • Remaining exceptions are recorded and passed back up the chain to (hopefully) be caught.

    • Uncaught exceptions should have a default behavior when Resolved. Exceptions could have various resolve times: Next exception added, Next exception check, when ResolveExceptions() is run, End of program, or ASAP. (perhaps)


Status: ALPHA


static const ExceptInfo &GetEmptyExcept()

Function to generate an empty exception (returned when an exception is checked, but none exist.)

static std::multimap<std::string, ExceptInfo> &GetExceptMap()

A map of all exceptions that have occurred and are awaiting to be dealt with.

inline void TriggerExcept(const std::string &in_id, const std::string &in_desc, bool in_error = true)

Provide information about an exception that needs to be triggered.

inline const ExceptInfo &GetExcept(const std::string &id)

Get the first waiting exception.

inline ExceptInfo PopExcept(const std::string &id)

Get and remove a waiting exception.

inline size_t CountExcepts()

How many exceptions are waiting to be dealt with?

inline bool HasExcept()

Are any exceptions waiting?

inline bool HasExcept(const std::string &id)

Are any exceptions of a particular type waiting?

inline void ClearExcepts()

Remove all waiting exceptions.

inline void ClearExcept(const std::string &id)

Remove all waiting exceptions of the desginated type.

template<typename ...Ts>
void Notify(Ts&&... args)

Send information to a program user (via standard error in native mode, or alert in Emscripten)

template<typename ...Ts>
void NotifyWarning(Ts&&... msg)

End user has done something possibly a problem.

template<typename ...Ts>
void NotifyError(Ts&&... msg)

End user has done something resulting in an non-recoverable problem.

template<typename ...Ts>
void LibraryWarning(Ts&&... msg)

Library user has made an error in how they are using the library.

template<typename ...Ts>
void LibraryError(Ts&&... msg)

Library user has made an error in how they are using the library.

template<typename ...Ts>
void InternalError(Ts&&... msg)

Original library implementers must have made an error.

struct ExceptInfo
#include <errors.hpp>

Information about an exception that has occured.

Public Members

std::string id

A unique string ID for this exception type.

std::string desc

A detailed description of thie exception.

bool default_to_error

Should we default to an error (or a warning) if not resolved?