Exception<> is a replacement (subclass) for any std c++ exception class (e.g. the default 'std::exception'), which adds UNICODE String support. More...
#include <Exceptions.h>
Public Member Functions | |
| Exception ()=delete | |
| construct with just a message - BASE_EXCEPTION gets whatever it minimally needs. | |
| virtual const char * | what () const noexcept override |
Public Member Functions inherited from Stroika::Foundation::Execution::ExceptionStringHelper | |
| ExceptionStringHelper ()=delete | |
| activities default to NULLOPT - meaning "not specified" - which is different from "specified,
and there were none". | |
| nonvirtual Characters::String | GetBasicErrorMessage () const |
| nonvirtual Characters::String | GetFullErrorMessage () const |
| nonvirtual optional< Containers::Stack< Activity<> > > | GetActivities () const |
| nonvirtual void | ImbueActivities (const optional< Containers::Stack< Activity<> > > &activities) |
| Set, replace, or clear the activity stack. Any already-computed message text is discarded, since it depends on these. | |
| template<typename T > | |
| nonvirtual T | As () const |
Protected Member Functions | |
| template<typename... BASE_EXCEPTION_ARGS> | |
| Exception (const Characters::String &reasonForError, BASE_EXCEPTION_ARGS... baseExceptionArgs) | |
Protected Member Functions inherited from Stroika::Foundation::Execution::ExceptionStringHelper | |
| nonvirtual const char * | _PeekAtNarrowSDKString () const |
Exception<> is a replacement (subclass) for any std c++ exception class (e.g. the default 'std::exception'), which adds UNICODE String support.
Stroika's Exception<> class is fully interoperable with the normal C++ exception classes, but its use offers two benefits: o It guarantees that UNICODE messages (including things like filenames) are properly preserved in the exception message, even if the system default code page (locale) does not allow representing those characters.
o It integrates neatly with the Stroika 'Activity' mechanism, whereby you declare current 'activities' on the stack and these are automatically integrated into exceptions thrown with Execution::Throw (), to provide clearer messages (e.g. instead of getting the error message o "(errno: 13)" OR o "Permission denied" Stroika returns something like: o "Permission denied {errno: 13} while binding to INADDR_ANY:80, while constructing static content webserver."
system_error (error_code = error_code ()), so THERE it is default-constructible and this ctor does match, yielding a useless empty code. MSVC has no such default. Do not rely on either behaviour.) Definition at line 219 of file Exceptions.h.
|
delete |
construct with just a message - BASE_EXCEPTION gets whatever it minimally needs.
Two overloads with mutually exclusive constraints, because the std exception types split into two groups and NEITHER spelling covers both: some are default-constructible, and some instead require a what_arg (and have no default ctor). The latter get "" - they need some string and do not care which, since
|
explicitprotected |
For BASE_EXCEPTION classes with constructors OTHER than just 'message' - you cannot use a 'using X = Exception(x)' but a subclass which uses this delegating method.
Definition at line 89 of file Exceptions.inl.
|
overridevirtualnoexcept |
Provide a 'c string' variant of the exception message. Convert the UNICODE string argument to a narrow-string (multibyte) in the current locale encoding.
Definition at line 95 of file Exceptions.inl.