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