RESTinio
exception.hpp
Go to the documentation of this file.
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.
25  : public std::runtime_error
26 {
28  public:
29  exception_t( const char * err )
30  : bast_type_t{ err }
31  {}
32 
33  exception_t( const std::string & err )
34  : bast_type_t{ err }
35  {}
36 
37  exception_t( string_view_t err )
38  : bast_type_t{ std::string{ err.data(), err.size() } }
39  {}
40 };
41 
42 } /* namespace restinio */
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, std::optional< Value_Type > >::type opt_value(const Parameter_Container &params, string_view_t key)
Gets the value of a parameter specified by key wrapped in std::optional<Value_Type> if parameter exis...
Definition: value_or.hpp:64
exception_t(const std::string &err)
Definition: exception.hpp:33
exception_t(const char *err)
Definition: exception.hpp:29
exception_t(string_view_t err)
Definition: exception.hpp:37
Exception class for all exceptions thrown by RESTinio.
Definition: exception.hpp:24