1 /*
2 	restinio
3 */
4 
5 /*!
6 	Exception class for all exceptions thrown by RESTinio.
7 */
8 
9 #pragma once
10 
11 #include <string>
12 #include <stdexcept>
13 
14 #include <restinio/string_view.hpp>
15 
16 namespace restinio
17 {
18 
19 //
20 // exception_t
21 //
22 
23 //! Exception class for all exceptions thrown by RESTinio.
24 class exception_t
25 	:	public std::runtime_error
26 {
27 	using bast_type_t = std::runtime_error;
28 	public:
exception_t(const char * err)29 		exception_t( const char * err )
30 			:	bast_type_t{ err }
31 		{}
32 
exception_t(const std::string & err)33 		exception_t( const std::string & err )
34 			:	bast_type_t{ err }
35 		{}
36 
exception_t(string_view_t err)37 		exception_t( string_view_t err )
38 			:	bast_type_t{ std::string{ err.data(), err.size() } }
39 		{}
40 };
41 
42 } /* namespace restinio */
43