| [385] | 1 | 'Classses/System/Exception.ab
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | #require <Classes/ActiveBasic/misc.ab>
 | 
|---|
 | 4 | 
 | 
|---|
| [391] | 5 | Namespace ActiveBasic
 | 
|---|
| [385] | 6 | '右のコメントは対応するCOR_E_ナントカのコード
 | 
|---|
 | 7 | Const AB_E_EXCEPTION = &h80041500 '80131500
 | 
|---|
 | 8 | Const AB_E_SYSTEM = &h80041501 '80131501
 | 
|---|
 | 9 | Const AB_E_ARGUMENT = E_INVALIDARG '80070057
 | 
|---|
 | 10 | Const AB_E_ARGUMENTOUTOFRANGE = E_INVALIDARG '80131502
 | 
|---|
 | 11 | Const AB_E_INDEXOUTOFRANGE = &h80041508 '80131508
 | 
|---|
 | 12 | Const AB_E_INVALIDOPERATION = &h80041509 '80131509
 | 
|---|
 | 13 | Const AB_E_NOTSUPPORTED = &h80041515 '80131515
 | 
|---|
 | 14 | Const AB_E_PLATFORMNOTSUPPORTED = &h80041539 '80131539
 | 
|---|
| [411] | 15 | Const AB_E_KEYNOTFOUND = &h80041577 '80131577
 | 
|---|
| [385] | 16 | 
 | 
|---|
| [391] | 17 | End Namespace
 | 
|---|
 | 18 | 
 | 
|---|
| [385] | 19 | /*
 | 
|---|
 | 20 | 現時点で不要そうなもの(System名前空間直下のもののみ)
 | 
|---|
 | 21 | AccessViolationException
 | 
|---|
 | 22 | ArrayTypeMismatchException
 | 
|---|
 | 23 | ArithmeticException
 | 
|---|
 | 24 | BadImageFormatException
 | 
|---|
 | 25 | DataMisalignedException
 | 
|---|
 | 26 | FormatException
 | 
|---|
 | 27 | InvalidCastException
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 | 当分(一部は未来永劫)不要そうなもの(System名前空間直下のもののみ)
 | 
|---|
 | 30 | AppDomainUnloadedException
 | 
|---|
 | 31 | CannotUnloadAppDomainException
 | 
|---|
 | 32 | ExecutionEngineException
 | 
|---|
 | 33 | InvalidProgramException
 | 
|---|
 | 34 | MemberAccessException
 | 
|---|
 | 35 |     FieldAccessException 
 | 
|---|
 | 36 |     MethodAccessException 
 | 
|---|
 | 37 |     MissingMemberException 
 | 
|---|
 | 38 | MulticastNotSupportedException
 | 
|---|
 | 39 | NullReferenceException
 | 
|---|
 | 40 | OverflowException
 | 
|---|
 | 41 | RankException
 | 
|---|
 | 42 | StackOverflowException
 | 
|---|
 | 43 | TypeInitializationException
 | 
|---|
 | 44 | TypeLoadException
 | 
|---|
 | 45 | TypeUnloadedException
 | 
|---|
 | 46 | UnauthorizedAccessException
 | 
|---|
 | 47 | */
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | Namespace System
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 | /*!
 | 
|---|
 | 52 | @brief  例外クラスの基本クラス
 | 
|---|
 | 53 | @author Egtra
 | 
|---|
 | 54 | @date   2007/11/16
 | 
|---|
 | 55 | */
 | 
|---|
 | 56 | Class Exception
 | 
|---|
 | 57 | Public
 | 
|---|
 | 58 |     /*!
 | 
|---|
 | 59 |     @biref  コンストラクタ
 | 
|---|
 | 60 |     */
 | 
|---|
 | 61 |     Sub Exception()
 | 
|---|
 | 62 |         init(GetType().FullName, Nothing)
 | 
|---|
| [391] | 63 |         hr = ActiveBasic.AB_E_EXCEPTION
 | 
|---|
| [385] | 64 |     End Sub
 | 
|---|
 | 65 |     /*!
 | 
|---|
 | 66 |     @biref  コンストラクタ
 | 
|---|
 | 67 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 68 |     */
 | 
|---|
 | 69 |     Sub Exception(message As String)
 | 
|---|
 | 70 |         init(message, Nothing)
 | 
|---|
| [391] | 71 |         hr = ActiveBasic.AB_E_EXCEPTION
 | 
|---|
| [385] | 72 |     End Sub
 | 
|---|
 | 73 |     /*!
 | 
|---|
 | 74 |     @biref  コンストラクタ
 | 
|---|
 | 75 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 76 |     @param[in] innerException   内部例外
 | 
|---|
 | 77 |     */
 | 
|---|
 | 78 |     Sub Exception(message As String, innerException As Exception)
 | 
|---|
 | 79 |         init(message, innerException)
 | 
|---|
| [391] | 80 |         hr = ActiveBasic.AB_E_EXCEPTION
 | 
|---|
| [385] | 81 |     End Sub
 | 
|---|
 | 82 | 
 | 
|---|
 | 83 |     'Methods
 | 
|---|
 | 84 | 
 | 
|---|
 | 85 |     /*!
 | 
|---|
 | 86 |     @brief  基本例外を返す
 | 
|---|
 | 87 |     @return 最初に投げられた大本の例外
 | 
|---|
 | 88 |     */
 | 
|---|
 | 89 |     Function GetBaseException() As Exception
 | 
|---|
 | 90 |         GetBaseException = This
 | 
|---|
 | 91 |         While ActiveBasic.IsNothing(GetBaseException.inner) = False
 | 
|---|
 | 92 |             GetBaseException = GetBaseException.inner
 | 
|---|
 | 93 |         Wend
 | 
|---|
 | 94 |     End Function
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 |     /*!
 | 
|---|
 | 97 |     @brief  文字列化する
 | 
|---|
 | 98 |     @return エラー内容を表す文字列
 | 
|---|
 | 99 |     */
 | 
|---|
 | 100 |     Override Function ToString() As String
 | 
|---|
 | 101 |         If Object.ReferenceEquals(toStr, Nothing) Then
 | 
|---|
 | 102 |             Dim sb = New System.Text.StringBuilder
 | 
|---|
 | 103 |             sb.Append(GetType().FullName).Append(": ")
 | 
|---|
 | 104 |             sb.Append(Message)
 | 
|---|
 | 105 |             toStr = sb.ToString
 | 
|---|
 | 106 |         End If
 | 
|---|
 | 107 |         Return toStr
 | 
|---|
 | 108 |     End Function
 | 
|---|
 | 109 | 
 | 
|---|
 | 110 |     'Properties
 | 
|---|
 | 111 | 
 | 
|---|
 | 112 |     /*!
 | 
|---|
 | 113 |     @brief  内部例外を返す
 | 
|---|
 | 114 |     @return これが保持している内部例外。無ければNothing。
 | 
|---|
 | 115 |     */
 | 
|---|
 | 116 |     Function InnerException() As Exception
 | 
|---|
 | 117 |         Return inner
 | 
|---|
 | 118 |     End Function
 | 
|---|
 | 119 | 
 | 
|---|
 | 120 |     /*!
 | 
|---|
 | 121 |     @brief  エラーメッセージの取得
 | 
|---|
 | 122 |     */
 | 
|---|
 | 123 |     Virtual Function Message() As String
 | 
|---|
 | 124 |         Return msg
 | 
|---|
 | 125 |     End Function
 | 
|---|
 | 126 | 
 | 
|---|
 | 127 |     /*!
 | 
|---|
 | 128 |     @brief  この例外に関連付けられたヘルプへのURLもしくはURNの設定
 | 
|---|
 | 129 |     */
 | 
|---|
 | 130 |     Virtual Sub HelpLink(help As String)
 | 
|---|
 | 131 |         helpLink = help
 | 
|---|
 | 132 |     End Sub
 | 
|---|
 | 133 | 
 | 
|---|
 | 134 |     /*!
 | 
|---|
 | 135 |     @brief  この例外に関連付けられたヘルプへのURLもしくはURNの取得
 | 
|---|
 | 136 |     */
 | 
|---|
 | 137 |     Virtual Function HelpLink() As String
 | 
|---|
 | 138 |         Return helpLink
 | 
|---|
 | 139 |     End Function
 | 
|---|
 | 140 | 
 | 
|---|
 | 141 |     /*!
 | 
|---|
 | 142 |     @brief  この例外の発生元のアプリケーションもしくはオブジェクトの設定
 | 
|---|
 | 143 |     */
 | 
|---|
 | 144 |     Virtual Sub Source(source As String)
 | 
|---|
 | 145 |         src = source
 | 
|---|
 | 146 |     End Sub
 | 
|---|
 | 147 | 
 | 
|---|
 | 148 |     /*!
 | 
|---|
 | 149 |     @brief  この例外の発生元のアプリケーションもしくはオブジェクトの取得
 | 
|---|
 | 150 |     */
 | 
|---|
 | 151 |     Virtual Function Source() As String
 | 
|---|
 | 152 |         Return src
 | 
|---|
 | 153 |     End Function
 | 
|---|
| [435] | 154 | 
 | 
|---|
| [385] | 155 |     /*!
 | 
|---|
 | 156 |     @brief  HRESULT値の設定
 | 
|---|
 | 157 |     */
 | 
|---|
 | 158 |     Sub HResult(hres As HRESULT)
 | 
|---|
 | 159 |         hr = hres
 | 
|---|
 | 160 |     End Sub
 | 
|---|
 | 161 | 
 | 
|---|
 | 162 |     /*!
 | 
|---|
 | 163 |     @brief  HRESULT値の取得
 | 
|---|
 | 164 |     */
 | 
|---|
 | 165 |     Function HResult() As HRESULT
 | 
|---|
 | 166 |         Return hr
 | 
|---|
 | 167 |     End Function
 | 
|---|
 | 168 | 
 | 
|---|
 | 169 | Private
 | 
|---|
 | 170 |     Sub init(message As String, innerException As Exception)
 | 
|---|
 | 171 |         msg = message
 | 
|---|
 | 172 |         inner = innerException
 | 
|---|
 | 173 |     End Sub
 | 
|---|
 | 174 | 
 | 
|---|
 | 175 |     msg As String
 | 
|---|
 | 176 |     toStr As String
 | 
|---|
 | 177 |     inner As Exception
 | 
|---|
 | 178 |     helpLink As String
 | 
|---|
 | 179 |     src As String
 | 
|---|
 | 180 |     hr As HRESULT
 | 
|---|
 | 181 | End Class
 | 
|---|
 | 182 | 
 | 
|---|
 | 183 | /*!
 | 
|---|
 | 184 | @brief  システム定義の例外の基底クラス
 | 
|---|
 | 185 | @author Egtra
 | 
|---|
 | 186 | @date   2007/11/17
 | 
|---|
 | 187 | */
 | 
|---|
 | 188 | Class SystemException
 | 
|---|
 | 189 |     Inherits Exception
 | 
|---|
 | 190 | Public
 | 
|---|
 | 191 |     /*!
 | 
|---|
 | 192 |     @biref  コンストラクタ
 | 
|---|
 | 193 |     */
 | 
|---|
 | 194 |     Sub SystemException()
 | 
|---|
 | 195 |         Exception(GetType().FullName, Nothing)
 | 
|---|
| [391] | 196 |         HResult = ActiveBasic.AB_E_SYSTEM
 | 
|---|
| [385] | 197 |     End Sub
 | 
|---|
 | 198 |     /*!
 | 
|---|
 | 199 |     @biref  コンストラクタ
 | 
|---|
 | 200 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 201 |     */
 | 
|---|
 | 202 |     Sub SystemException(message As String)
 | 
|---|
 | 203 |         Exception(message, Nothing)
 | 
|---|
| [391] | 204 |         HResult = ActiveBasic.AB_E_SYSTEM
 | 
|---|
| [385] | 205 |     End Sub
 | 
|---|
 | 206 |     /*!
 | 
|---|
 | 207 |     @biref  コンストラクタ
 | 
|---|
 | 208 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 209 |     @param[in] innerException   内部例外
 | 
|---|
 | 210 |     */
 | 
|---|
 | 211 |     Sub SystemException(message As String, innerException As Exception)
 | 
|---|
 | 212 |         Exception(message, innerException)
 | 
|---|
| [391] | 213 |         HResult = ActiveBasic.AB_E_SYSTEM
 | 
|---|
| [385] | 214 |     End Sub
 | 
|---|
 | 215 | End Class
 | 
|---|
 | 216 | 
 | 
|---|
 | 217 | /*!
 | 
|---|
 | 218 | @brief  実引数に問題があることを表す例外
 | 
|---|
 | 219 | @author Egtra
 | 
|---|
 | 220 | @date   2007/11/19
 | 
|---|
 | 221 | */
 | 
|---|
 | 222 | Class ArgumentException
 | 
|---|
 | 223 |     Inherits SystemException
 | 
|---|
 | 224 | Public
 | 
|---|
 | 225 |     /*!
 | 
|---|
 | 226 |     @biref  コンストラクタ
 | 
|---|
 | 227 |     */
 | 
|---|
 | 228 |     Sub ArgumentException()
 | 
|---|
 | 229 |         SystemException("One or more arguments have invalid value.", Nothing)
 | 
|---|
| [391] | 230 |         HResult = ActiveBasic.AB_E_ARGUMENT
 | 
|---|
| [385] | 231 |     End Sub
 | 
|---|
 | 232 |     /*!
 | 
|---|
 | 233 |     @biref  コンストラクタ
 | 
|---|
 | 234 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 235 |     */
 | 
|---|
 | 236 |     Sub ArgumentException(message As String)
 | 
|---|
 | 237 |         SystemException(message, Nothing)
 | 
|---|
| [391] | 238 |         HResult = ActiveBasic.AB_E_ARGUMENT
 | 
|---|
| [385] | 239 |     End Sub
 | 
|---|
 | 240 |     /*!
 | 
|---|
 | 241 |     @biref  コンストラクタ
 | 
|---|
 | 242 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 243 |     @param[in] innerException   内部例外
 | 
|---|
 | 244 |     */
 | 
|---|
 | 245 |     Sub ArgumentException(message As String, innerException As Exception)
 | 
|---|
 | 246 |         SystemException(message, innerException)
 | 
|---|
| [391] | 247 |         HResult = ActiveBasic.AB_E_ARGUMENT
 | 
|---|
| [385] | 248 |     End Sub
 | 
|---|
 | 249 |     /*!
 | 
|---|
 | 250 |     @biref  コンストラクタ
 | 
|---|
 | 251 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 252 |     @param[in] paramName    原因となった仮引数名
 | 
|---|
 | 253 |     */
 | 
|---|
 | 254 |     Sub ArgumentException(message As String, paramName As String)
 | 
|---|
 | 255 |         SystemException(message, Nothing)
 | 
|---|
 | 256 |         param = paramName
 | 
|---|
| [391] | 257 |         HResult = ActiveBasic.AB_E_ARGUMENT
 | 
|---|
| [385] | 258 |     End Sub
 | 
|---|
 | 259 |     /*!
 | 
|---|
 | 260 |     @biref  コンストラクタ
 | 
|---|
 | 261 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 262 |     @param[in] innerException   内部例外
 | 
|---|
 | 263 |     @param[in] paramName    原因となった仮引数名
 | 
|---|
 | 264 |     */
 | 
|---|
 | 265 |     Sub ArgumentException(message As String, paramName As String, innerException As Exception)
 | 
|---|
 | 266 |         SystemException(message, innerException)
 | 
|---|
 | 267 |         param = paramName
 | 
|---|
| [391] | 268 |         HResult = ActiveBasic.AB_E_ARGUMENT
 | 
|---|
| [385] | 269 |     End Sub
 | 
|---|
 | 270 | 
 | 
|---|
 | 271 |     Override Function Message() As String
 | 
|---|
 | 272 |         Dim sb = New System.Text.StringBuilder
 | 
|---|
 | 273 |         sb.Append(param).Append(": ").Append(Super.Message)
 | 
|---|
 | 274 |         Return sb.ToString
 | 
|---|
 | 275 |     End Function
 | 
|---|
 | 276 | 
 | 
|---|
 | 277 |     /*!
 | 
|---|
 | 278 |     @brief  この例外の発生原因の仮引数名の取得
 | 
|---|
 | 279 |     */
 | 
|---|
 | 280 |     Virtual Function Param() As String
 | 
|---|
 | 281 |         Return param
 | 
|---|
 | 282 |     End Function
 | 
|---|
 | 283 | Private
 | 
|---|
 | 284 |     param As String
 | 
|---|
 | 285 | End Class
 | 
|---|
 | 286 | 
 | 
|---|
 | 287 | /*!
 | 
|---|
 | 288 | @brief  NothingまたはNULLを受け付けない引数にそれらが渡されたことを表す例外
 | 
|---|
 | 289 | @author Egtra
 | 
|---|
 | 290 | @date   2007/11/19
 | 
|---|
 | 291 | */
 | 
|---|
 | 292 | Class ArgumentNullException
 | 
|---|
 | 293 |     Inherits ArgumentException
 | 
|---|
 | 294 | Public
 | 
|---|
 | 295 |     /*!
 | 
|---|
 | 296 |     @biref  コンストラクタ
 | 
|---|
 | 297 |     */
 | 
|---|
 | 298 |     Sub ArgumentNullException()
 | 
|---|
 | 299 |         ArgumentException("One or more arguments have Nothing or Null value.", "", Nothing)
 | 
|---|
 | 300 |         HResult = E_POINTER
 | 
|---|
 | 301 |     End Sub
 | 
|---|
 | 302 |     /*!
 | 
|---|
 | 303 |     @biref  コンストラクタ
 | 
|---|
 | 304 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 305 |     */
 | 
|---|
 | 306 |     Sub ArgumentNullException(message As String)
 | 
|---|
 | 307 |         ArgumentException(message, "", Nothing)
 | 
|---|
 | 308 |         HResult = E_POINTER
 | 
|---|
 | 309 |     End Sub
 | 
|---|
 | 310 |     /*!
 | 
|---|
 | 311 |     @biref  コンストラクタ
 | 
|---|
 | 312 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 313 |     @param[in] innerException   内部例外
 | 
|---|
 | 314 |     */
 | 
|---|
 | 315 |     Sub ArgumentNullException(message As String, innerException As Exception)
 | 
|---|
 | 316 |         ArgumentException(message, "", innerException)
 | 
|---|
 | 317 |         HResult = E_POINTER
 | 
|---|
 | 318 |     End Sub
 | 
|---|
 | 319 |     /*!
 | 
|---|
 | 320 |     @biref  コンストラクタ
 | 
|---|
 | 321 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 322 |     @param[in] paramName    原因となった仮引数名
 | 
|---|
 | 323 |     */
 | 
|---|
 | 324 |     Sub ArgumentNullException(message As String, paramName As String)
 | 
|---|
 | 325 |         ArgumentException(message, paramName)
 | 
|---|
 | 326 |         HResult = E_POINTER
 | 
|---|
 | 327 |     End Sub
 | 
|---|
 | 328 | End Class
 | 
|---|
 | 329 | 
 | 
|---|
 | 330 | /*!
 | 
|---|
 | 331 | @brief  規定された範囲を超える実引数が渡されたことを表す例外
 | 
|---|
 | 332 | @author Egtra
 | 
|---|
 | 333 | @date   2007/11/19
 | 
|---|
 | 334 | */
 | 
|---|
 | 335 | Class ArgumentOutOfRangeException
 | 
|---|
 | 336 |     Inherits ArgumentException
 | 
|---|
 | 337 | Public
 | 
|---|
 | 338 |     /*!
 | 
|---|
 | 339 |     @biref  コンストラクタ
 | 
|---|
 | 340 |     */
 | 
|---|
 | 341 |     Sub ArgumentOutOfRangeException()
 | 
|---|
 | 342 |         ArgumentException("One or more arguments ware out of range value.", "", Nothing)
 | 
|---|
| [391] | 343 |         HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
 | 
|---|
| [385] | 344 |     End Sub
 | 
|---|
 | 345 |     /*!
 | 
|---|
 | 346 |     @biref  コンストラクタ
 | 
|---|
 | 347 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 348 |     */
 | 
|---|
 | 349 |     Sub ArgumentOutOfRangeException(message As String)
 | 
|---|
 | 350 |         ArgumentException(message, "", Nothing)
 | 
|---|
| [391] | 351 |         HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
 | 
|---|
| [385] | 352 |     End Sub
 | 
|---|
 | 353 |     /*!
 | 
|---|
 | 354 |     @biref  コンストラクタ
 | 
|---|
 | 355 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 356 |     @param[in] innerException   内部例外
 | 
|---|
 | 357 |     */
 | 
|---|
 | 358 |     Sub ArgumentOutOfRangeException(message As String, innerException As Exception)
 | 
|---|
 | 359 |         ArgumentException(message, "", innerException)
 | 
|---|
| [391] | 360 |         HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
 | 
|---|
| [385] | 361 |     End Sub
 | 
|---|
 | 362 |     /*!
 | 
|---|
 | 363 |     @biref  コンストラクタ
 | 
|---|
 | 364 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 365 |     @param[in] paramName    原因となった仮引数名
 | 
|---|
 | 366 |     */
 | 
|---|
 | 367 |     Sub ArgumentOutOfRangeException(message As String, paramName As String)
 | 
|---|
 | 368 |         ArgumentException(message, paramName, Nothing)
 | 
|---|
| [391] | 369 |         HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
 | 
|---|
| [385] | 370 |     End Sub
 | 
|---|
 | 371 |     /*!
 | 
|---|
 | 372 |     @biref  コンストラクタ
 | 
|---|
 | 373 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 374 |     @param[in] actualValue  問題となった仮引数の値
 | 
|---|
 | 375 |     @param[in] paramName    原因となった仮引数名
 | 
|---|
 | 376 |     */
 | 
|---|
 | 377 |     Sub ArgumentOutOfRangeException(message As String, actualValue As Object, paramName As String)
 | 
|---|
 | 378 |         ArgumentException(message, paramName, Nothing)
 | 
|---|
 | 379 |         actualValueObject = actualValue
 | 
|---|
| [391] | 380 |         HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
 | 
|---|
| [385] | 381 |     End Sub
 | 
|---|
 | 382 | 
 | 
|---|
 | 383 |     /*!
 | 
|---|
 | 384 |     @brief  この例外の発生原因の実引数の値の取得
 | 
|---|
 | 385 |     */
 | 
|---|
 | 386 |     Virtual Function ActualValue() As Object
 | 
|---|
 | 387 |         Return actualValueObject
 | 
|---|
 | 388 |     End Function
 | 
|---|
 | 389 | 
 | 
|---|
 | 390 |     Override Function Message() As String
 | 
|---|
 | 391 |         If ActiveBasic.IsNothing(actualValueObject) Then
 | 
|---|
 | 392 |             Return Super.Message
 | 
|---|
 | 393 |         Else
 | 
|---|
 | 394 |             Dim sb = New System.Text.StringBuilder
 | 
|---|
 | 395 |             sb.Append(Param).Append(" = ").Append(actualValueObject)
 | 
|---|
 | 396 |             sb.Append(": ").Append(Super.Message)
 | 
|---|
 | 397 |             Return sb.ToString
 | 
|---|
 | 398 |         End If
 | 
|---|
 | 399 |     End Function
 | 
|---|
 | 400 | Private
 | 
|---|
 | 401 |     actualValueObject As Object
 | 
|---|
 | 402 | End Class
 | 
|---|
 | 403 | 
 | 
|---|
 | 404 | /*!
 | 
|---|
 | 405 | @brief  配列の範囲外の要素を読み書きしようとしたことを表す例外
 | 
|---|
 | 406 | @author Egtra
 | 
|---|
 | 407 | @date   2007/11/19
 | 
|---|
 | 408 | */
 | 
|---|
 | 409 | Class IndexOutOfRangeException
 | 
|---|
 | 410 |     Inherits SystemException
 | 
|---|
 | 411 | Public
 | 
|---|
 | 412 |     /*!
 | 
|---|
 | 413 |     @biref  コンストラクタ
 | 
|---|
 | 414 |     */
 | 
|---|
 | 415 |     Sub IndexOutOfRangeException()
 | 
|---|
 | 416 |         SystemException("The index was out of range value.", Nothing)
 | 
|---|
| [391] | 417 |         HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
 | 
|---|
| [385] | 418 |     End Sub
 | 
|---|
 | 419 |     /*!
 | 
|---|
 | 420 |     @biref  コンストラクタ
 | 
|---|
 | 421 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 422 |     */
 | 
|---|
 | 423 |     Sub IndexOutOfRangeException(message As String)
 | 
|---|
 | 424 |         SystemException(message, Nothing)
 | 
|---|
| [391] | 425 |         HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
 | 
|---|
| [385] | 426 |     End Sub
 | 
|---|
 | 427 |     /*!
 | 
|---|
 | 428 |     @biref  コンストラクタ
 | 
|---|
 | 429 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 430 |     @param[in] innerException   内部例外
 | 
|---|
 | 431 |     */
 | 
|---|
 | 432 |     Sub IndexOutOfRangeException(message As String, innerException As Exception)
 | 
|---|
 | 433 |         SystemException(message, innerException)
 | 
|---|
| [391] | 434 |         HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
 | 
|---|
| [385] | 435 |     End Sub
 | 
|---|
 | 436 | End Class
 | 
|---|
 | 437 | 
 | 
|---|
 | 438 | /*!
 | 
|---|
 | 439 | @brief  無効な操作を行おうとしたことを表す例外
 | 
|---|
 | 440 | @author Egtra
 | 
|---|
 | 441 | @date   2007/11/19
 | 
|---|
 | 442 | */
 | 
|---|
 | 443 | Class InvalidOperationException
 | 
|---|
 | 444 |     Inherits SystemException
 | 
|---|
 | 445 | Public
 | 
|---|
 | 446 |     /*!
 | 
|---|
 | 447 |     @biref  コンストラクタ
 | 
|---|
 | 448 |     */
 | 
|---|
 | 449 |     Sub InvalidOperationException()
 | 
|---|
 | 450 |         SystemException("The operation is invalid.", Nothing)
 | 
|---|
| [391] | 451 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
| [385] | 452 |     End Sub
 | 
|---|
 | 453 |     /*!
 | 
|---|
 | 454 |     @biref  コンストラクタ
 | 
|---|
 | 455 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 456 |     */
 | 
|---|
 | 457 |     Sub InvalidOperationException(message As String)
 | 
|---|
 | 458 |         SystemException(message, Nothing)
 | 
|---|
| [391] | 459 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
| [385] | 460 |     End Sub
 | 
|---|
 | 461 |     /*!
 | 
|---|
 | 462 |     @biref  コンストラクタ
 | 
|---|
 | 463 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 464 |     @param[in] innerException   内部例外
 | 
|---|
 | 465 |     */
 | 
|---|
 | 466 |     Sub InvalidOperationException(message As String, innerException As Exception)
 | 
|---|
 | 467 |         SystemException(message, innerException)
 | 
|---|
| [391] | 468 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
| [385] | 469 |     End Sub
 | 
|---|
 | 470 | End Class
 | 
|---|
 | 471 | 
 | 
|---|
 | 472 | /*!
 | 
|---|
| [391] | 473 | @brief  博されたオブジェクトを操作しようとしたことを表す例外
 | 
|---|
 | 474 | @author Egtra
 | 
|---|
 | 475 | @date   2007/12/06
 | 
|---|
 | 476 | */
 | 
|---|
 | 477 | Class ObjectDisposedException
 | 
|---|
 | 478 |     Inherits InvalidOperationException
 | 
|---|
 | 479 | Public
 | 
|---|
 | 480 |     /*!
 | 
|---|
 | 481 |     @biref  コンストラクタ
 | 
|---|
 | 482 |     */
 | 
|---|
 | 483 |     Sub ObjectDisposedException()
 | 
|---|
 | 484 |         InvalidOperationException("The object has been disposed.", Nothing)
 | 
|---|
 | 485 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
 | 486 |     End Sub
 | 
|---|
 | 487 |     /*!
 | 
|---|
 | 488 |     @biref  コンストラクタ
 | 
|---|
 | 489 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 490 |     */
 | 
|---|
 | 491 |     Sub ObjectDisposedException(message As String)
 | 
|---|
 | 492 |         InvalidOperationException(message, Nothing)
 | 
|---|
 | 493 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
 | 494 |     End Sub
 | 
|---|
 | 495 |     /*!
 | 
|---|
 | 496 |     @biref  コンストラクタ
 | 
|---|
 | 497 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 498 |     @param[in] innerException   内部例外
 | 
|---|
 | 499 |     */
 | 
|---|
 | 500 |     Sub ObjectDisposedException(message As String, innerException As Exception)
 | 
|---|
 | 501 |         InvalidOperationException(message, innerException)
 | 
|---|
 | 502 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
 | 503 |     End Sub
 | 
|---|
 | 504 |     /*!
 | 
|---|
 | 505 |     @biref  コンストラクタ
 | 
|---|
 | 506 |     @param[in] objectName   操作しようとしたオブジェクトの名前
 | 
|---|
 | 507 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 508 |     */
 | 
|---|
 | 509 |     Sub ObjectDisposedException(objectName As String, message As String)
 | 
|---|
 | 510 |         InvalidOperationException(message, Nothing)
 | 
|---|
 | 511 |         HResult = ActiveBasic.AB_E_INVALIDOPERATION
 | 
|---|
 | 512 |         objName = " object: " + objectName
 | 
|---|
 | 513 |     End Sub
 | 
|---|
 | 514 |     /*!
 | 
|---|
 | 515 |     @brief  この例外が発生したとき、操作しようとしていたオブジェクトの名前を返す。
 | 
|---|
 | 516 |     */
 | 
|---|
 | 517 |     Function ObjectName() As String
 | 
|---|
 | 518 |         Return objName
 | 
|---|
 | 519 |     End Function
 | 
|---|
 | 520 | 
 | 
|---|
 | 521 |     Override Function ToString() As String
 | 
|---|
 | 522 |         ToString = Super.ToString()
 | 
|---|
 | 523 |         If Not ActiveBasic.IsNothing(objName) Then
 | 
|---|
 | 524 |             ToString += objName
 | 
|---|
 | 525 |         End If
 | 
|---|
 | 526 |     End Function
 | 
|---|
 | 527 | Private
 | 
|---|
 | 528 |     objName As String
 | 
|---|
 | 529 | End Class
 | 
|---|
 | 530 | 
 | 
|---|
 | 531 | /*!
 | 
|---|
| [385] | 532 | @brief  そのメソッド・関数ないし操作が実装されていないことを表す例外
 | 
|---|
 | 533 | @author Egtra
 | 
|---|
 | 534 | @date   2007/11/19
 | 
|---|
 | 535 | */
 | 
|---|
 | 536 | Class NotImplementedException
 | 
|---|
 | 537 |     Inherits SystemException
 | 
|---|
 | 538 | Public
 | 
|---|
 | 539 |     /*!
 | 
|---|
 | 540 |     @biref  コンストラクタ
 | 
|---|
 | 541 |     */
 | 
|---|
 | 542 |     Sub NotImplementedException()
 | 
|---|
 | 543 |         SystemException("Not implemented.", Nothing)
 | 
|---|
 | 544 |         HResult = E_NOTIMPL
 | 
|---|
 | 545 |     End Sub
 | 
|---|
 | 546 |     /*!
 | 
|---|
 | 547 |     @biref  コンストラクタ
 | 
|---|
 | 548 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 549 |     */
 | 
|---|
 | 550 |     Sub NotImplementedException(message As String)
 | 
|---|
 | 551 |         SystemException(message, Nothing)
 | 
|---|
 | 552 |         HResult = E_NOTIMPL
 | 
|---|
 | 553 |     End Sub
 | 
|---|
 | 554 |     /*!
 | 
|---|
 | 555 |     @biref  コンストラクタ
 | 
|---|
 | 556 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 557 |     @param[in] innerException   内部例外
 | 
|---|
 | 558 |     */
 | 
|---|
 | 559 |     Sub NotImplementedException(message As String, innerException As Exception)
 | 
|---|
 | 560 |         SystemException(message, innerException)
 | 
|---|
 | 561 |         HResult = E_NOTIMPL
 | 
|---|
 | 562 |     End Sub
 | 
|---|
 | 563 | End Class
 | 
|---|
 | 564 | 
 | 
|---|
 | 565 | /*!
 | 
|---|
 | 566 | @brief  対応していないメソッド・関数ないし操作を行おうとしたことを表す例外
 | 
|---|
 | 567 | @author Egtra
 | 
|---|
 | 568 | @date   2007/11/19
 | 
|---|
 | 569 | */
 | 
|---|
 | 570 | Class NotSupportedException
 | 
|---|
 | 571 |     Inherits SystemException
 | 
|---|
 | 572 | Public
 | 
|---|
 | 573 |     /*!
 | 
|---|
 | 574 |     @biref  コンストラクタ
 | 
|---|
 | 575 |     */
 | 
|---|
 | 576 |     Sub NotSupportedException()
 | 
|---|
 | 577 |         SystemException("This operation is not supported,", Nothing)
 | 
|---|
| [391] | 578 |         HResult = ActiveBasic.AB_E_NOTSUPPORTED
 | 
|---|
| [385] | 579 |     End Sub
 | 
|---|
 | 580 |     /*!
 | 
|---|
 | 581 |     @biref  コンストラクタ
 | 
|---|
 | 582 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 583 |     */
 | 
|---|
 | 584 |     Sub NotSupportedException(message As String)
 | 
|---|
 | 585 |         SystemException(message, Nothing)
 | 
|---|
| [391] | 586 |         HResult = ActiveBasic.AB_E_NOTSUPPORTED
 | 
|---|
| [385] | 587 |     End Sub
 | 
|---|
 | 588 |     /*!
 | 
|---|
 | 589 |     @biref  コンストラクタ
 | 
|---|
 | 590 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 591 |     @param[in] innerException   内部例外
 | 
|---|
 | 592 |     */
 | 
|---|
 | 593 |     Sub NotSupportedException(message As String, innerException As Exception)
 | 
|---|
 | 594 |         SystemException(message, innerException)
 | 
|---|
| [391] | 595 |         HResult = ActiveBasic.AB_E_NOTSUPPORTED
 | 
|---|
| [385] | 596 |     End Sub
 | 
|---|
 | 597 | End Class
 | 
|---|
 | 598 | 
 | 
|---|
 | 599 | /*!
 | 
|---|
 | 600 | @brief  実行しているプラットフォームで対応していないメソッド・関数ないし操作を行おうとしたことを表す例外
 | 
|---|
 | 601 | @author Egtra
 | 
|---|
 | 602 | @date   2007/11/19
 | 
|---|
 | 603 | */
 | 
|---|
 | 604 | Class PlatformNotSupportedException
 | 
|---|
 | 605 |     Inherits NotSupportedException
 | 
|---|
 | 606 | Public
 | 
|---|
 | 607 |     /*!
 | 
|---|
 | 608 |     @biref  コンストラクタ
 | 
|---|
 | 609 |     */
 | 
|---|
 | 610 |     Sub PlatformNotSupportedException()
 | 
|---|
 | 611 |         NotSupportedException("This operation is not supported in this platform.", Nothing)
 | 
|---|
| [391] | 612 |         HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
 | 
|---|
| [385] | 613 |     End Sub
 | 
|---|
 | 614 |     /*!
 | 
|---|
 | 615 |     @biref  コンストラクタ
 | 
|---|
 | 616 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 617 |     */
 | 
|---|
 | 618 |     Sub PlatformNotSupportedException(message As String)
 | 
|---|
 | 619 |         NotSupportedException(message, Nothing)
 | 
|---|
| [391] | 620 |         HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
 | 
|---|
| [385] | 621 |     End Sub
 | 
|---|
 | 622 |     /*!
 | 
|---|
 | 623 |     @biref  コンストラクタ
 | 
|---|
 | 624 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 625 |     @param[in] innerException   内部例外
 | 
|---|
 | 626 |     */
 | 
|---|
 | 627 |     Sub PlatformNotSupportedException(message As String, innerException As Exception)
 | 
|---|
 | 628 |         NotSupportedException(message, innerException)
 | 
|---|
| [391] | 629 |         HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
 | 
|---|
| [385] | 630 |     End Sub
 | 
|---|
 | 631 | End Class
 | 
|---|
 | 632 | 
 | 
|---|
 | 633 | /*!
 | 
|---|
 | 634 | @brief  操作が取り止められたことを表す例外
 | 
|---|
 | 635 | @author Egtra
 | 
|---|
 | 636 | @date   2007/11/19
 | 
|---|
 | 637 | @todo   HResultの調査
 | 
|---|
 | 638 | */
 | 
|---|
 | 639 | Class OperationCanceledException
 | 
|---|
 | 640 |     Inherits SystemException
 | 
|---|
 | 641 | Public
 | 
|---|
 | 642 |     /*!
 | 
|---|
 | 643 |     @biref  コンストラクタ
 | 
|---|
 | 644 |     */
 | 
|---|
 | 645 |     Sub OperationCanceledException()
 | 
|---|
 | 646 |         SystemException("The operation was canceled.", Nothing)
 | 
|---|
 | 647 |     End Sub
 | 
|---|
 | 648 |     /*!
 | 
|---|
 | 649 |     @biref  コンストラクタ
 | 
|---|
 | 650 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 651 |     */
 | 
|---|
 | 652 |     Sub OperationCanceledException(message As String)
 | 
|---|
 | 653 |         SystemException(message, Nothing)
 | 
|---|
 | 654 |     End Sub
 | 
|---|
 | 655 |     /*!
 | 
|---|
 | 656 |     @biref  コンストラクタ
 | 
|---|
 | 657 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 658 |     @param[in] innerException   内部例外
 | 
|---|
 | 659 |     */
 | 
|---|
 | 660 |     Sub OperationCanceledException(message As String, innerException As Exception)
 | 
|---|
 | 661 |         SystemException(message, innerException)
 | 
|---|
 | 662 |     End Sub
 | 
|---|
 | 663 | End Class
 | 
|---|
 | 664 | 
 | 
|---|
 | 665 | /*!
 | 
|---|
 | 666 | @brief  メモリ不足例外
 | 
|---|
 | 667 | @author Egtra
 | 
|---|
 | 668 | @date   2007/11/19
 | 
|---|
 | 669 | @todo   HResultの調査
 | 
|---|
 | 670 | */
 | 
|---|
 | 671 | Class OutOfMemoryException
 | 
|---|
 | 672 |     Inherits SystemException
 | 
|---|
 | 673 | Public
 | 
|---|
 | 674 |     /*!
 | 
|---|
 | 675 |     @biref  コンストラクタ
 | 
|---|
 | 676 |     */
 | 
|---|
 | 677 |     Sub OutOfMemoryException()
 | 
|---|
 | 678 |         SystemException("Out of memory.", Nothing)
 | 
|---|
 | 679 |         HResult = E_OUTOFMEMORY
 | 
|---|
 | 680 |     End Sub
 | 
|---|
 | 681 |     /*!
 | 
|---|
 | 682 |     @biref  コンストラクタ
 | 
|---|
 | 683 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 684 |     */
 | 
|---|
 | 685 |     Sub OutOfMemoryException(message As String)
 | 
|---|
 | 686 |         SystemException(message, Nothing)
 | 
|---|
 | 687 |         HResult = E_OUTOFMEMORY
 | 
|---|
 | 688 |     End Sub
 | 
|---|
 | 689 |     /*!
 | 
|---|
 | 690 |     @biref  コンストラクタ
 | 
|---|
 | 691 |     @param[in] message  エラーメッセージ
 | 
|---|
 | 692 |     @param[in] innerException   内部例外
 | 
|---|
 | 693 |     */
 | 
|---|
 | 694 |     Sub OutOfMemoryException(message As String, innerException As Exception)
 | 
|---|
 | 695 |         SystemException(message, innerException)
 | 
|---|
 | 696 |         HResult = E_OUTOFMEMORY
 | 
|---|
 | 697 |     End Sub
 | 
|---|
 | 698 | End Class
 | 
|---|
 | 699 | 
 | 
|---|
 | 700 | 
 | 
|---|
 | 701 | End Namespace
 | 
|---|