aboutsummaryrefslogtreecommitdiff
path: root/brep/module
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-15 09:10:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-15 09:10:10 +0200
commita96a346e4ab58729b1f257268f2d2af1ebdca890 (patch)
tree73ad795433a1efd2f7a2a341e18f83f7d3c0c837 /brep/module
parent17683bcc74284c344dc67f5a9b806801af5c598f (diff)
Misc compilation fixes
Diffstat (limited to 'brep/module')
-rw-r--r--brep/module24
1 files changed, 16 insertions, 8 deletions
diff --git a/brep/module b/brep/module
index dfcf7ad..f6144f2 100644
--- a/brep/module
+++ b/brep/module
@@ -6,6 +6,7 @@
#define BREP_MODULE
#include <brep/diagnostics>
+#include <web/module>
namespace brep
{
@@ -21,6 +22,8 @@ namespace brep
//@@ Maybe optional "try again" link?
//
+ invalid_request (const char* d, web::status_code s = 422)
+ : status (s), description (d) {}
};
// And this exception indicated a server error (5XX). In particular,
@@ -31,6 +34,8 @@ namespace brep
struct server_error
{
diag_data data;
+
+ server_error (diag_data&& d) : data (std::move (d)) {}
};
// Every module member function that needs to produce any diagnostics
@@ -46,7 +51,7 @@ namespace brep
const basic_mark error (severity::error, \
this->log_writer_, \
__PRETTY_FUNCTION__); \
- const basic_mark warn (severity::warn, \
+ const basic_mark warn (severity::warning, \
this->log_writer_, \
__PRETTY_FUNCTION__); \
const basic_mark info (severity::info, \
@@ -65,11 +70,13 @@ namespace brep
// There will, however, most likely be a conflict between
// web::module and our module. Or maybe not, need to try.
//
- using status_code;
- using name_value;
- using name_values;
- using request;
- using response;
+
+ using web::status_code;
+ using web::name_value;
+ using web::name_values;
+ using web::request;
+ using web::response;
+ using web::log;
class module: public web::module
{
@@ -90,8 +97,8 @@ namespace brep
//
std::uint16_t verb_ {0};
- template <class F> static void level1 (const F& f) {if (verb_ >= 1) f ();}
- template <class F> static void level2 (const F& f) {if (verb_ >= 2) f ();}
+ template <class F> void level1 (const F& f) const {if (verb_ >= 1) f ();}
+ template <class F> void level2 (const F& f) const {if (verb_ >= 2) f ();}
// Implementation details.
//
@@ -109,6 +116,7 @@ namespace brep
void
log_write (diag_data&&) const;
+ protected:
const diag_epilogue log_writer_;
};
}