-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZErrors.h
45 lines (40 loc) · 939 Bytes
/
ZErrors.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
#ifndef _ZERRORS_H_
#define _ZERRORS_H_
#include <typeinfo>
class SystemException
{
public:
ZTvar obj;
zcstring Messege;
SystemException(ZTvar& cobj):obj(cobj)
{
Messege.append(_ZC("System Exception"));
}
ZChar* Speak()
{
gZTR eobj=boost::apply_visitor(getZTR(),obj);
Messege.append(_ZC(" in Object of type "));
Messege.append( eobj.cont->Oname() );
Messege.append(_ZC(" whose value is "));
Messege.append( boost::apply_visitor(ToString(),obj));
Messege.append(_ZC("\r\n"));
return (const_cast<ZChar*>(Messege.c_str()));
}
};
class ArithmeticException : public SystemException
{
public:
ArithmeticException(ZTvar& cobj):SystemException(cobj)
{
Messege.append(_ZC("\r\nArithmetic Exception"));
}
};
class DivisionByZeroException : public ArithmeticException
{
public:
DivisionByZeroException(ZTvar& cobj):ArithmeticException(cobj)
{
Messege.append(_ZC("\r\nDivision By Zero Exception"));
}
};
#endif