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