diff options
Diffstat (limited to 'c/err.h')
-rw-r--r-- | c/err.h | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +#ifndef ERR_H +#define ERR_H + +#include <exception> +#include <string> + +enum ErrType : unsigned char +{ + GENERIC, + WINDOWS, + WININET, + LIBXML2 +}; + +struct Err +{ + std::wstring what; + Err(ErrType t, const wchar_t* fmt = L"%s"); + inline Err(ErrType t, std::wstring fmt) : Err(t, fmt.c_str()) {} +}; + +/* Return a wide string describing exception. */ +std::wstring What(std::exception_ptr e = std::current_exception()); + +#endif |