aboutsummaryrefslogtreecommitdiff
path: root/brep/module
blob: 6687a313f2ea77556b4682ed28fd5e8ddbd5bf4d (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
33
34
35
36
37
38
39
40
41
42
43
// file      : brep/module -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#ifndef BREP_MODULE
#define BREP_MODULE

namespace brep
{
  // This exception is used to signal that the request is invalid
  // (4XX codes) rather than that it could not be processed (5XX).
  // By default 422 is returned, which means the request was
  // semantically invalid.
  //
  struct invalid_request
  {
    web::status_code status {422};
    std::string description;

    //@@ Maybe optional "try again" link?
    //
  };

  // Adaptation of the web::module to our needs.
  //
  class module: public web::module
  {
  public:
    virtual void
    handle (request&, response&) = 0;

    // Implementation details.
    //
  protected:
    virtual void
    handle (request&, response&, log&);

  protected:
    log* log_;
  };
}

#endif // BREP_MODULE