aboutsummaryrefslogtreecommitdiff
path: root/brep/module.cxx
blob: 1837ccd6606f7c34cf6c38e99750a97140522674 (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
// file      : brep/module.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#include <brep/module>

using namespace std;

namespace brep
{
  void module::
  handle (request& rq, response& rs, log& l)
  {
    log_ = &l;

    try
    {
      handle (rq, rs);
    }
    catch (const invalid_request& e)
    {
      // @@ Format as HTML in proper style.
      //
      rs.content (e.status, "text/html;charset=utf-8") << e.description;
    }
    catch (const exception& e)
    {
      // @@ Exception: log e.what () & 505.
      //
      rs.status (505);
    }
    catch (...)
    {
      // @@ Unknown exception: log & 505.
      //
      rs.status (505);
    }
  }
}