Phoenix
Object-oriented orthogonally persistent operating system
|
00001 /* 00002 * /phoenix/include/triton/exception.h 00003 * 00004 * This file is a part of Phoenix operating system. 00005 * Copyright (c) 2011-2012, Artyom Lebedev <artyom.lebedev@gmail.com> 00006 * All rights reserved. 00007 * See COPYING file for copyright details. 00008 */ 00009 00014 #ifndef EXCEPTION_H_ 00015 #define EXCEPTION_H_ 00016 00017 namespace triton { 00018 00020 class TritonError: public Object { 00021 private: 00023 const char *_file; 00025 int _line; 00026 public: 00027 TritonError() {} 00028 00029 virtual 00030 ~TritonError() {} 00031 00033 virtual const char * 00034 __name__() const 00035 { 00036 return "TritonError"; 00037 } 00038 00039 //XXX __str__ 00041 virtual const char * 00042 __desc__() const 00043 { 00044 return "Generic error"; 00045 } 00046 }; 00047 00049 class NullPtrError: public TritonError { 00050 public: 00052 virtual const char * 00053 __name__() const 00054 { 00055 return "NullPtrError"; 00056 } 00057 00058 //XXX __str__ 00060 virtual const char * 00061 __desc__() const 00062 { 00063 return "Null-pointer dereferencing"; 00064 } 00065 }; 00066 00068 class MemoryError: public TritonError { 00069 public: 00071 virtual const char * 00072 __name__() const 00073 { 00074 return "MemoryError"; 00075 } 00076 00077 //xxx __str__ 00079 virtual const char * 00080 __desc__() const 00081 { 00082 //XXX allocation size info 00083 return "Memory allocation failure"; 00084 } 00085 }; 00086 00090 class LookupError: public TritonError { 00091 public: 00093 virtual const char * 00094 __name__() const 00095 { 00096 return "LookupError"; 00097 } 00098 00099 //xxx __str__ 00100 }; 00101 00103 class IndexError: public LookupError { 00104 public: 00106 virtual const char * 00107 __name__() const 00108 { 00109 return "IndexError"; 00110 } 00111 00112 //xxx __str__ 00113 }; 00114 00118 class KeyError: public LookupError { 00119 public: 00121 virtual const char * 00122 __name__() const 00123 { 00124 return "KeyError"; 00125 } 00126 00127 //xxx __str__ 00128 }; 00129 00130 } /* namespace triton */ 00131 00132 #endif /* EXCEPTION_H_ */