3 // utakata内で標準的に利用される、汎用的な例外を定義します。
4 // ここで定義されている例外は、全てexception::Exceptionから派生し、
5 // exception_macro.hのマクロが適用可能となっています。
7 // ここで定義されている汎用例外は以下となります。
9 // exception::NullException
10 // -> NULLであってはならない場合に送出される例外です。
11 // exception::OutOfRangeException
12 // -> 範囲外である場合に送出される例外です。
13 #ifndef _UTAKATA_SRC_EXCEPTION_STD_H_
14 #define _UTAKATA_SRC_EXCEPTION_STD_H_
17 #include "src/exception.h"
27 class NullException : public exception::Exception {
28 // NULLであることが想定外である場合に送出される例外です。
30 NullException(const unicode::UniString& message, const ExceptionInfo& info) :
31 Exception(message, info) {}
33 NullException(const Exception& prev, const unicode::UniString& message,
34 const ExceptionInfo& info) :
35 Exception(prev, message, info) {}
37 virtual const char* what() const throw() {return "NullException";}
40 class OutOfRangeException : public exception::Exception {
41 // 引数などが範囲外である場合などに送出される例外です。
43 OutOfRangeException(const unicode::UniString& message,
44 const ExceptionInfo& info)
45 : Exception(message, info) {}
47 OutOfRangeException(const Exception& prev, const unicode::UniString& message,
48 const ExceptionInfo& info)
49 : Exception(prev, message, info) {}
51 virtual const char* what() const throw() {return "OutOfRangeException";}
57 #endif /* _UTAKATA_SRC_EXCEPTION_STD_H_ */