aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/Exception.h
blob: 580fc1656b99cce3dbb75b13f003b671aa7d079c (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
#pragma once

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

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"