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 | DimClient::addErrorHandler(this);
|
---|
26 | }
|
---|
27 |
|
---|
28 | void DimErrorRedirecter::errorHandler(int severity, int code, char *msg)
|
---|
29 | {
|
---|
30 | switch (severity)
|
---|
31 | {
|
---|
32 | case DIM_FATAL: fMsg.Error(msg); return;
|
---|
33 | case DIM_ERROR: fMsg.Error(msg); return;
|
---|
34 | case DIM_WARNING: fMsg.Warn(msg); return;
|
---|
35 | case DIM_INFO: fMsg.Info(msg); return;
|
---|
36 | }
|
---|
37 |
|
---|
38 | stringstream str;
|
---|
39 | str << "Severity of Dim message unknown(" << severity << "): ";
|
---|
40 | str << msg << "(" << code << ")";
|
---|
41 | fMsg.Message(str);
|
---|
42 |
|
---|
43 | /*
|
---|
44 | DIMDNSUNDEF DIM_FATAL DIM_DNS_NODE undefined
|
---|
45 | DIMDNSREFUS DIM_FATAL DIM_DNS refuses connection
|
---|
46 | DIMDNSDUPLC DIM_FATAL Service already exists in DNS
|
---|
47 | DIMDNSEXIT DIM_FATAL DNS requests server to EXIT
|
---|
48 | DIMDNSTMOUT DIM_WARNING Server failed sending Watchdog
|
---|
49 |
|
---|
50 | DIMDNSCNERR DIM_ERROR Connection to DNS failed
|
---|
51 | DIMDNSCNEST DIM_INFO Connection to DNS established
|
---|
52 |
|
---|
53 | DIMSVCDUPLC DIM_ERROR Service already exists in Server
|
---|
54 | DIMSVCFORMT DIM_ERROR Bad format string for service
|
---|
55 | DIMSVCINVAL DIM_ERROR Invalid Service ID
|
---|
56 |
|
---|
57 | DIMTCPRDERR DIM_ERROR TCP/IP read error
|
---|
58 | DIMTCPWRRTY DIM_WARNING TCP/IP write error - Retrying
|
---|
59 | DIMTCPWRTMO DIM_ERROR TCP/IP write error - Disconnected
|
---|
60 | DIMTCPLNERR DIM_ERROR TCP/IP listen error
|
---|
61 | DIMTCPOPERR DIM_ERROR TCP/IP open server error
|
---|
62 | DIMTCPCNERR DIM_ERROR TCP/IP connection error
|
---|
63 | DIMTCPCNEST DIM_INFO TCP/IP connection established
|
---|
64 | */
|
---|
65 | }
|
---|
66 |
|
---|