1 | // **************************************************************************
|
---|
2 | /** @class DimErrorRedirecter
|
---|
3 |
|
---|
4 | */
|
---|
5 | // **************************************************************************
|
---|
6 | #include "DimErrorRedirecter.h"
|
---|
7 |
|
---|
8 | #include <dic.hxx>
|
---|
9 |
|
---|
10 | #include "WindowLog.h"
|
---|
11 | #include "MessageImp.h"
|
---|
12 |
|
---|
13 | using namespace std;
|
---|
14 |
|
---|
15 | int DimErrorRedirecter::cnt = 0;
|
---|
16 |
|
---|
17 | DimErrorRedirecter::DimErrorRedirecter(MessageImp &imp) : fMsg(imp)
|
---|
18 | {
|
---|
19 | if (cnt++)
|
---|
20 | {
|
---|
21 | fMsg.Error("ERROR - More than one instance of MyHandlers.");
|
---|
22 | exit(-1);
|
---|
23 | }
|
---|
24 |
|
---|
25 | dic_disable_padding();
|
---|
26 | dis_disable_padding();
|
---|
27 |
|
---|
28 | DimClient::addErrorHandler(this);
|
---|
29 | }
|
---|
30 |
|
---|
31 | DimErrorRedirecter::~DimErrorRedirecter()
|
---|
32 | {
|
---|
33 | DimClient::addErrorHandler(0);
|
---|
34 | }
|
---|
35 |
|
---|
36 | void DimErrorRedirecter::errorHandler(int severity, int code, char *msg)
|
---|
37 | {
|
---|
38 | switch (severity)
|
---|
39 | {
|
---|
40 | case DIM_FATAL: fMsg.Error(msg); return;
|
---|
41 | case DIM_ERROR: fMsg.Error(msg); return;
|
---|
42 | case DIM_WARNING: fMsg.Warn(msg); return;
|
---|
43 | case DIM_INFO: fMsg.Info(msg); return;
|
---|
44 | }
|
---|
45 |
|
---|
46 | stringstream str;
|
---|
47 | str << "Severity of Dim message unknown(" << severity << "): ";
|
---|
48 | str << msg << "(" << code << ")";
|
---|
49 | fMsg.Message(str);
|
---|
50 |
|
---|
51 | /*
|
---|
52 | DIMDNSUNDEF DIM_FATAL DIM_DNS_NODE undefined
|
---|
53 | DIMDNSREFUS DIM_FATAL DIM_DNS refuses connection
|
---|
54 | DIMDNSDUPLC DIM_FATAL Service already exists in DNS
|
---|
55 | DIMDNSEXIT DIM_FATAL DNS requests server to EXIT
|
---|
56 | DIMDNSTMOUT DIM_WARNING Server failed sending Watchdog
|
---|
57 |
|
---|
58 | DIMDNSCNERR DIM_ERROR Connection to DNS failed
|
---|
59 | DIMDNSCNEST DIM_INFO Connection to DNS established
|
---|
60 |
|
---|
61 | DIMSVCDUPLC DIM_ERROR Service already exists in Server
|
---|
62 | DIMSVCFORMT DIM_ERROR Bad format string for service
|
---|
63 | DIMSVCINVAL DIM_ERROR Invalid Service ID
|
---|
64 |
|
---|
65 | DIMTCPRDERR DIM_ERROR TCP/IP read error
|
---|
66 | DIMTCPWRRTY DIM_WARNING TCP/IP write error - Retrying
|
---|
67 | DIMTCPWRTMO DIM_ERROR TCP/IP write error - Disconnected
|
---|
68 | DIMTCPLNERR DIM_ERROR TCP/IP listen error
|
---|
69 | DIMTCPOPERR DIM_ERROR TCP/IP open server error
|
---|
70 | DIMTCPCNERR DIM_ERROR TCP/IP connection error
|
---|
71 | DIMTCPCNEST DIM_INFO TCP/IP connection established
|
---|
72 | */
|
---|
73 | }
|
---|
74 |
|
---|