-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.cpp
43 lines (32 loc) · 882 Bytes
/
error.cpp
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
#include "error.hpp"
using namespace std;
namespace dsmq {
/**
* function dsmq_category
*/
namespace detail {
string dsmq_category::message( int value ) const
{
switch ( static_cast< dsmq_errc >( value ) ) {
case dsmq_errc::not_ok: return "server returned nok";
case dsmq_errc::exception: return "exception caught";
case dsmq_errc::server_error: return "server side error";
case dsmq_errc::protocol_violation: return "protocol violation";
case dsmq_errc::timeout: return "timeout";
}
return "unknown dsmq::dsmq_category error";
}
} // namespace detail
error_category const& dsmq_category()
{
static detail::dsmq_category instance;
return instance;
}
/**
* function make_error_code
*/
error_code make_error_code( dsmq_errc e )
{
return { static_cast< int >( e ), dsmq_category() };
}
} // namespace dsmq