-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDDEException.cpp
99 lines (83 loc) · 2.45 KB
/
DDEException.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: DDEEXCEPTION.CPP
** COMPONENT: Network & Comms Library
** DESCRIPTION: CDDEException class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "DDEException.hpp"
#include "DDEInst.hpp"
#include "DDECltConv.hpp"
#include <Core/StringUtils.hpp>
/******************************************************************************
** Method: Constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CDDEException::CDDEException(int eErrCode, uint nDDECode)
: m_nDDECode(nDDECode)
{
// Get error code as #defined symbol.
CString strErrDef = CDDEInst::GetErrorCode(m_nDDECode);
// Convert error to string.
switch(eErrCode)
{
case E_INIT_FAILED:
m_details = Core::fmt(TXT("Failed to initialise DDE: %s"), strErrDef.c_str());
break;
case E_CONN_FAILED:
m_details = Core::fmt(TXT("Failed to connect to DDE server: %s"), strErrDef.c_str());
break;
case E_STRING_FAILED:
m_details = Core::fmt(TXT("Failed to create DDE string: %s"), strErrDef.c_str());
break;
case E_REQUEST_FAILED:
m_details = Core::fmt(TXT("Failed to request DDE item: %s"), strErrDef.c_str());
break;
case E_LINK_FAILED:
m_details = Core::fmt(TXT("Failed to create DDE advise loop: %s"), strErrDef.c_str());
break;
case E_ALLOC_FAILED:
m_details = Core::fmt(TXT("Failed to allocate DDE data handle: %s"), strErrDef.c_str());
break;
case E_QUERY_FAILED:
m_details = Core::fmt(TXT("Failed to query DDE servers: %s"), strErrDef.c_str());
break;
case E_EXECUTE_FAILED:
m_details = Core::fmt(TXT("Failed to execute a DDE command: %s"), strErrDef.c_str());
break;
case E_POKE_FAILED:
m_details = Core::fmt(TXT("Failed to poke an item: %s"), strErrDef.c_str());
break;
case E_STRCOPY_FAILED:
m_details = Core::fmt(TXT("Failed to query string data: %s"), strErrDef.c_str());
break;
// Shouldn't happen!
default:
ASSERT_FALSE();
break;
}
}
/******************************************************************************
** Method: Destructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CDDEException::~CDDEException() throw()
{
}