aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/Exception.h
blob: ed3ab15827a9c6c348c835607e7a9e673e99b9c4 (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
26
27
28
29
30
31
32
#pragma once

#include <exception>
#include <string>
#include <format>

namespace crepe {

//! Exception class
class Exception : public std::exception {
public:
	//! Exception with plain message
	Exception(const std::string & msg);

	//! Exception with \c std::format message
	template<class... Args>
	Exception(std::format_string<Args...> fmt, Args&&... args);

	//! Get formatted error message
	const char * what() const noexcept;

protected:
	Exception() = default;

	//! Formatted error message
	std::string error;
};

} // namespace crepe

#include "Exception.hpp"