aboutsummaryrefslogtreecommitdiff
path: root/c/err.h
blob: d4a9976e638002aeedd1b1a86b51b36b95735b6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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