-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathscrerror.h
78 lines (64 loc) · 2.26 KB
/
screrror.h
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
/***************************************************************************
Exception blocks
***************************************************************************/
class ParseNode;
class COleScript;
interface IScanner;
inline void FreeExcepInfo(EXCEPINFO *pei)
{
if (pei->bstrSource)
SysFreeString(pei->bstrSource);
if (pei->bstrDescription)
SysFreeString(pei->bstrDescription);
if (pei->bstrHelpFile)
SysFreeString(pei->bstrHelpFile);
memset(pei, 0, sizeof(*pei));
}
void CopyException (EXCEPINFO *pexcepinfoDest, const EXCEPINFO *pexcepinfoSource);
HRESULT MapHr(HRESULT hr, ErrorTypeEnum * errorTypeOut = nullptr);
class SRCINFO;
class ActiveScriptError;
class ScriptException
{
public:
int32 ichMin;
int32 ichLim;
EXCEPINFO ei;
public:
ScriptException()
{ memset(this, 0, sizeof(*this)); }
~ScriptException(void);
public:
void CopyInto(ScriptException *pse);
void Free();
void GetError(HRESULT *phr, EXCEPINFO *pei); // Clears error.
};
class CompileScriptException : public ScriptException
{
public:
int32 line; // line number of error (zero based)
int32 ichMinLine; // starting char of the line
bool hasLineNumberInfo;
// TODO: if the line contains \0 character the substring following \0 will not be included:
BSTR bstrLine; // source line (if available)
public:
CompileScriptException(void) : ScriptException(), line(0), ichMinLine(0), hasLineNumberInfo(false),
bstrLine(nullptr)
{ }
~CompileScriptException();
public:
void Free();
void GetError(HRESULT *phr, EXCEPINFO *pei)
{
ScriptException::GetError(phr, pei);
Free();
}
void CopyInto(CompileScriptException* cse);
HRESULT ProcessError(IScanner * pScan, HRESULT hr, ParseNode * pnodeBase, LPCWSTR stringOne = _u(""), LPCWSTR stringTwo = _u(""));
friend class ActiveScriptError;
};