[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 |
|
---|
[559] | 155 | Const Function ErrorCode() As HRESULT
|
---|
| 156 | ErrorCode = hr
|
---|
| 157 | End Function
|
---|
| 158 | Protected
|
---|
[385] | 159 | /*!
|
---|
| 160 | @brief HRESULT値の設定
|
---|
| 161 | */
|
---|
| 162 | Sub HResult(hres As HRESULT)
|
---|
| 163 | hr = hres
|
---|
| 164 | End Sub
|
---|
| 165 |
|
---|
| 166 | /*!
|
---|
| 167 | @brief HRESULT値の取得
|
---|
| 168 | */
|
---|
| 169 | Function HResult() As HRESULT
|
---|
| 170 | Return hr
|
---|
| 171 | End Function
|
---|
| 172 |
|
---|
| 173 | Private
|
---|
| 174 | Sub init(message As String, innerException As Exception)
|
---|
| 175 | msg = message
|
---|
| 176 | inner = innerException
|
---|
| 177 | End Sub
|
---|
| 178 |
|
---|
| 179 | msg As String
|
---|
| 180 | toStr As String
|
---|
| 181 | inner As Exception
|
---|
| 182 | helpLink As String
|
---|
| 183 | src As String
|
---|
| 184 | hr As HRESULT
|
---|
| 185 | End Class
|
---|
| 186 |
|
---|
| 187 | /*!
|
---|
| 188 | @brief システム定義の例外の基底クラス
|
---|
| 189 | @author Egtra
|
---|
| 190 | @date 2007/11/17
|
---|
| 191 | */
|
---|
| 192 | Class SystemException
|
---|
| 193 | Inherits Exception
|
---|
| 194 | Public
|
---|
| 195 | /*!
|
---|
| 196 | @biref コンストラクタ
|
---|
| 197 | */
|
---|
| 198 | Sub SystemException()
|
---|
| 199 | Exception(GetType().FullName, Nothing)
|
---|
[391] | 200 | HResult = ActiveBasic.AB_E_SYSTEM
|
---|
[385] | 201 | End Sub
|
---|
| 202 | /*!
|
---|
| 203 | @biref コンストラクタ
|
---|
| 204 | @param[in] message エラーメッセージ
|
---|
| 205 | */
|
---|
| 206 | Sub SystemException(message As String)
|
---|
| 207 | Exception(message, Nothing)
|
---|
[391] | 208 | HResult = ActiveBasic.AB_E_SYSTEM
|
---|
[385] | 209 | End Sub
|
---|
| 210 | /*!
|
---|
| 211 | @biref コンストラクタ
|
---|
| 212 | @param[in] message エラーメッセージ
|
---|
| 213 | @param[in] innerException 内部例外
|
---|
| 214 | */
|
---|
| 215 | Sub SystemException(message As String, innerException As Exception)
|
---|
| 216 | Exception(message, innerException)
|
---|
[391] | 217 | HResult = ActiveBasic.AB_E_SYSTEM
|
---|
[385] | 218 | End Sub
|
---|
| 219 | End Class
|
---|
| 220 |
|
---|
| 221 | /*!
|
---|
| 222 | @brief 実引数に問題があることを表す例外
|
---|
| 223 | @author Egtra
|
---|
| 224 | @date 2007/11/19
|
---|
| 225 | */
|
---|
| 226 | Class ArgumentException
|
---|
| 227 | Inherits SystemException
|
---|
| 228 | Public
|
---|
| 229 | /*!
|
---|
| 230 | @biref コンストラクタ
|
---|
| 231 | */
|
---|
| 232 | Sub ArgumentException()
|
---|
| 233 | SystemException("One or more arguments have invalid value.", Nothing)
|
---|
[391] | 234 | HResult = ActiveBasic.AB_E_ARGUMENT
|
---|
[385] | 235 | End Sub
|
---|
| 236 | /*!
|
---|
| 237 | @biref コンストラクタ
|
---|
| 238 | @param[in] message エラーメッセージ
|
---|
| 239 | */
|
---|
| 240 | Sub ArgumentException(message As String)
|
---|
| 241 | SystemException(message, Nothing)
|
---|
[391] | 242 | HResult = ActiveBasic.AB_E_ARGUMENT
|
---|
[385] | 243 | End Sub
|
---|
| 244 | /*!
|
---|
| 245 | @biref コンストラクタ
|
---|
| 246 | @param[in] message エラーメッセージ
|
---|
| 247 | @param[in] innerException 内部例外
|
---|
| 248 | */
|
---|
| 249 | Sub ArgumentException(message As String, innerException As Exception)
|
---|
| 250 | SystemException(message, innerException)
|
---|
[391] | 251 | HResult = ActiveBasic.AB_E_ARGUMENT
|
---|
[385] | 252 | End Sub
|
---|
| 253 | /*!
|
---|
| 254 | @biref コンストラクタ
|
---|
| 255 | @param[in] message エラーメッセージ
|
---|
| 256 | @param[in] paramName 原因となった仮引数名
|
---|
| 257 | */
|
---|
| 258 | Sub ArgumentException(message As String, paramName As String)
|
---|
| 259 | SystemException(message, Nothing)
|
---|
| 260 | param = paramName
|
---|
[391] | 261 | HResult = ActiveBasic.AB_E_ARGUMENT
|
---|
[385] | 262 | End Sub
|
---|
| 263 | /*!
|
---|
| 264 | @biref コンストラクタ
|
---|
| 265 | @param[in] message エラーメッセージ
|
---|
| 266 | @param[in] innerException 内部例外
|
---|
| 267 | @param[in] paramName 原因となった仮引数名
|
---|
| 268 | */
|
---|
| 269 | Sub ArgumentException(message As String, paramName As String, innerException As Exception)
|
---|
| 270 | SystemException(message, innerException)
|
---|
| 271 | param = paramName
|
---|
[391] | 272 | HResult = ActiveBasic.AB_E_ARGUMENT
|
---|
[385] | 273 | End Sub
|
---|
| 274 |
|
---|
| 275 | Override Function Message() As String
|
---|
| 276 | Dim sb = New System.Text.StringBuilder
|
---|
| 277 | sb.Append(param).Append(": ").Append(Super.Message)
|
---|
| 278 | Return sb.ToString
|
---|
| 279 | End Function
|
---|
| 280 |
|
---|
| 281 | /*!
|
---|
| 282 | @brief この例外の発生原因の仮引数名の取得
|
---|
| 283 | */
|
---|
| 284 | Virtual Function Param() As String
|
---|
| 285 | Return param
|
---|
| 286 | End Function
|
---|
| 287 | Private
|
---|
| 288 | param As String
|
---|
| 289 | End Class
|
---|
| 290 |
|
---|
| 291 | /*!
|
---|
| 292 | @brief NothingまたはNULLを受け付けない引数にそれらが渡されたことを表す例外
|
---|
| 293 | @author Egtra
|
---|
| 294 | @date 2007/11/19
|
---|
| 295 | */
|
---|
| 296 | Class ArgumentNullException
|
---|
| 297 | Inherits ArgumentException
|
---|
| 298 | Public
|
---|
| 299 | /*!
|
---|
| 300 | @biref コンストラクタ
|
---|
| 301 | */
|
---|
| 302 | Sub ArgumentNullException()
|
---|
| 303 | ArgumentException("One or more arguments have Nothing or Null value.", "", Nothing)
|
---|
| 304 | HResult = E_POINTER
|
---|
| 305 | End Sub
|
---|
| 306 | /*!
|
---|
| 307 | @biref コンストラクタ
|
---|
| 308 | @param[in] message エラーメッセージ
|
---|
| 309 | */
|
---|
| 310 | Sub ArgumentNullException(message As String)
|
---|
| 311 | ArgumentException(message, "", Nothing)
|
---|
| 312 | HResult = E_POINTER
|
---|
| 313 | End Sub
|
---|
| 314 | /*!
|
---|
| 315 | @biref コンストラクタ
|
---|
| 316 | @param[in] message エラーメッセージ
|
---|
| 317 | @param[in] innerException 内部例外
|
---|
| 318 | */
|
---|
| 319 | Sub ArgumentNullException(message As String, innerException As Exception)
|
---|
| 320 | ArgumentException(message, "", innerException)
|
---|
| 321 | HResult = E_POINTER
|
---|
| 322 | End Sub
|
---|
| 323 | /*!
|
---|
| 324 | @biref コンストラクタ
|
---|
| 325 | @param[in] message エラーメッセージ
|
---|
| 326 | @param[in] paramName 原因となった仮引数名
|
---|
| 327 | */
|
---|
| 328 | Sub ArgumentNullException(message As String, paramName As String)
|
---|
| 329 | ArgumentException(message, paramName)
|
---|
| 330 | HResult = E_POINTER
|
---|
| 331 | End Sub
|
---|
| 332 | End Class
|
---|
| 333 |
|
---|
| 334 | /*!
|
---|
| 335 | @brief 規定された範囲を超える実引数が渡されたことを表す例外
|
---|
| 336 | @author Egtra
|
---|
| 337 | @date 2007/11/19
|
---|
| 338 | */
|
---|
| 339 | Class ArgumentOutOfRangeException
|
---|
| 340 | Inherits ArgumentException
|
---|
| 341 | Public
|
---|
| 342 | /*!
|
---|
| 343 | @biref コンストラクタ
|
---|
| 344 | */
|
---|
| 345 | Sub ArgumentOutOfRangeException()
|
---|
| 346 | ArgumentException("One or more arguments ware out of range value.", "", Nothing)
|
---|
[391] | 347 | HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
|
---|
[385] | 348 | End Sub
|
---|
| 349 | /*!
|
---|
| 350 | @biref コンストラクタ
|
---|
| 351 | @param[in] message エラーメッセージ
|
---|
| 352 | */
|
---|
| 353 | Sub ArgumentOutOfRangeException(message As String)
|
---|
| 354 | ArgumentException(message, "", Nothing)
|
---|
[391] | 355 | HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
|
---|
[385] | 356 | End Sub
|
---|
| 357 | /*!
|
---|
| 358 | @biref コンストラクタ
|
---|
| 359 | @param[in] message エラーメッセージ
|
---|
| 360 | @param[in] innerException 内部例外
|
---|
| 361 | */
|
---|
| 362 | Sub ArgumentOutOfRangeException(message As String, innerException As Exception)
|
---|
| 363 | ArgumentException(message, "", innerException)
|
---|
[391] | 364 | HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
|
---|
[385] | 365 | End Sub
|
---|
| 366 | /*!
|
---|
| 367 | @biref コンストラクタ
|
---|
| 368 | @param[in] message エラーメッセージ
|
---|
| 369 | @param[in] paramName 原因となった仮引数名
|
---|
| 370 | */
|
---|
| 371 | Sub ArgumentOutOfRangeException(message As String, paramName As String)
|
---|
| 372 | ArgumentException(message, paramName, Nothing)
|
---|
[391] | 373 | HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
|
---|
[385] | 374 | End Sub
|
---|
| 375 | /*!
|
---|
| 376 | @biref コンストラクタ
|
---|
| 377 | @param[in] message エラーメッセージ
|
---|
| 378 | @param[in] actualValue 問題となった仮引数の値
|
---|
| 379 | @param[in] paramName 原因となった仮引数名
|
---|
| 380 | */
|
---|
| 381 | Sub ArgumentOutOfRangeException(message As String, actualValue As Object, paramName As String)
|
---|
| 382 | ArgumentException(message, paramName, Nothing)
|
---|
| 383 | actualValueObject = actualValue
|
---|
[391] | 384 | HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
|
---|
[385] | 385 | End Sub
|
---|
| 386 |
|
---|
| 387 | /*!
|
---|
| 388 | @brief この例外の発生原因の実引数の値の取得
|
---|
| 389 | */
|
---|
| 390 | Virtual Function ActualValue() As Object
|
---|
| 391 | Return actualValueObject
|
---|
| 392 | End Function
|
---|
| 393 |
|
---|
| 394 | Override Function Message() As String
|
---|
| 395 | If ActiveBasic.IsNothing(actualValueObject) Then
|
---|
| 396 | Return Super.Message
|
---|
| 397 | Else
|
---|
| 398 | Dim sb = New System.Text.StringBuilder
|
---|
| 399 | sb.Append(Param).Append(" = ").Append(actualValueObject)
|
---|
| 400 | sb.Append(": ").Append(Super.Message)
|
---|
| 401 | Return sb.ToString
|
---|
| 402 | End If
|
---|
| 403 | End Function
|
---|
| 404 | Private
|
---|
| 405 | actualValueObject As Object
|
---|
| 406 | End Class
|
---|
| 407 |
|
---|
| 408 | /*!
|
---|
| 409 | @brief 配列の範囲外の要素を読み書きしようとしたことを表す例外
|
---|
| 410 | @author Egtra
|
---|
| 411 | @date 2007/11/19
|
---|
| 412 | */
|
---|
| 413 | Class IndexOutOfRangeException
|
---|
| 414 | Inherits SystemException
|
---|
| 415 | Public
|
---|
| 416 | /*!
|
---|
| 417 | @biref コンストラクタ
|
---|
| 418 | */
|
---|
| 419 | Sub IndexOutOfRangeException()
|
---|
| 420 | SystemException("The index was out of range value.", Nothing)
|
---|
[391] | 421 | HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
|
---|
[385] | 422 | End Sub
|
---|
| 423 | /*!
|
---|
| 424 | @biref コンストラクタ
|
---|
| 425 | @param[in] message エラーメッセージ
|
---|
| 426 | */
|
---|
| 427 | Sub IndexOutOfRangeException(message As String)
|
---|
| 428 | SystemException(message, Nothing)
|
---|
[391] | 429 | HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
|
---|
[385] | 430 | End Sub
|
---|
| 431 | /*!
|
---|
| 432 | @biref コンストラクタ
|
---|
| 433 | @param[in] message エラーメッセージ
|
---|
| 434 | @param[in] innerException 内部例外
|
---|
| 435 | */
|
---|
| 436 | Sub IndexOutOfRangeException(message As String, innerException As Exception)
|
---|
| 437 | SystemException(message, innerException)
|
---|
[391] | 438 | HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
|
---|
[385] | 439 | End Sub
|
---|
| 440 | End Class
|
---|
| 441 |
|
---|
| 442 | /*!
|
---|
| 443 | @brief 無効な操作を行おうとしたことを表す例外
|
---|
| 444 | @author Egtra
|
---|
| 445 | @date 2007/11/19
|
---|
| 446 | */
|
---|
| 447 | Class InvalidOperationException
|
---|
| 448 | Inherits SystemException
|
---|
| 449 | Public
|
---|
| 450 | /*!
|
---|
| 451 | @biref コンストラクタ
|
---|
| 452 | */
|
---|
| 453 | Sub InvalidOperationException()
|
---|
| 454 | SystemException("The operation is invalid.", Nothing)
|
---|
[391] | 455 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
[385] | 456 | End Sub
|
---|
| 457 | /*!
|
---|
| 458 | @biref コンストラクタ
|
---|
| 459 | @param[in] message エラーメッセージ
|
---|
| 460 | */
|
---|
| 461 | Sub InvalidOperationException(message As String)
|
---|
| 462 | SystemException(message, Nothing)
|
---|
[391] | 463 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
[385] | 464 | End Sub
|
---|
| 465 | /*!
|
---|
| 466 | @biref コンストラクタ
|
---|
| 467 | @param[in] message エラーメッセージ
|
---|
| 468 | @param[in] innerException 内部例外
|
---|
| 469 | */
|
---|
| 470 | Sub InvalidOperationException(message As String, innerException As Exception)
|
---|
| 471 | SystemException(message, innerException)
|
---|
[391] | 472 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
[385] | 473 | End Sub
|
---|
| 474 | End Class
|
---|
| 475 |
|
---|
| 476 | /*!
|
---|
[391] | 477 | @brief 博されたオブジェクトを操作しようとしたことを表す例外
|
---|
| 478 | @author Egtra
|
---|
| 479 | @date 2007/12/06
|
---|
| 480 | */
|
---|
| 481 | Class ObjectDisposedException
|
---|
| 482 | Inherits InvalidOperationException
|
---|
| 483 | Public
|
---|
| 484 | /*!
|
---|
| 485 | @biref コンストラクタ
|
---|
| 486 | */
|
---|
| 487 | Sub ObjectDisposedException()
|
---|
| 488 | InvalidOperationException("The object has been disposed.", Nothing)
|
---|
| 489 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
| 490 | End Sub
|
---|
| 491 | /*!
|
---|
| 492 | @biref コンストラクタ
|
---|
| 493 | @param[in] message エラーメッセージ
|
---|
| 494 | */
|
---|
| 495 | Sub ObjectDisposedException(message As String)
|
---|
| 496 | InvalidOperationException(message, Nothing)
|
---|
| 497 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
| 498 | End Sub
|
---|
| 499 | /*!
|
---|
| 500 | @biref コンストラクタ
|
---|
| 501 | @param[in] message エラーメッセージ
|
---|
| 502 | @param[in] innerException 内部例外
|
---|
| 503 | */
|
---|
| 504 | Sub ObjectDisposedException(message As String, innerException As Exception)
|
---|
| 505 | InvalidOperationException(message, innerException)
|
---|
| 506 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
| 507 | End Sub
|
---|
| 508 | /*!
|
---|
| 509 | @biref コンストラクタ
|
---|
| 510 | @param[in] objectName 操作しようとしたオブジェクトの名前
|
---|
| 511 | @param[in] message エラーメッセージ
|
---|
| 512 | */
|
---|
| 513 | Sub ObjectDisposedException(objectName As String, message As String)
|
---|
| 514 | InvalidOperationException(message, Nothing)
|
---|
| 515 | HResult = ActiveBasic.AB_E_INVALIDOPERATION
|
---|
| 516 | objName = " object: " + objectName
|
---|
| 517 | End Sub
|
---|
| 518 | /*!
|
---|
| 519 | @brief この例外が発生したとき、操作しようとしていたオブジェクトの名前を返す。
|
---|
| 520 | */
|
---|
| 521 | Function ObjectName() As String
|
---|
| 522 | Return objName
|
---|
| 523 | End Function
|
---|
| 524 |
|
---|
| 525 | Override Function ToString() As String
|
---|
| 526 | ToString = Super.ToString()
|
---|
| 527 | If Not ActiveBasic.IsNothing(objName) Then
|
---|
| 528 | ToString += objName
|
---|
| 529 | End If
|
---|
| 530 | End Function
|
---|
| 531 | Private
|
---|
| 532 | objName As String
|
---|
| 533 | End Class
|
---|
| 534 |
|
---|
| 535 | /*!
|
---|
[385] | 536 | @brief そのメソッド・関数ないし操作が実装されていないことを表す例外
|
---|
| 537 | @author Egtra
|
---|
| 538 | @date 2007/11/19
|
---|
| 539 | */
|
---|
| 540 | Class NotImplementedException
|
---|
| 541 | Inherits SystemException
|
---|
| 542 | Public
|
---|
| 543 | /*!
|
---|
| 544 | @biref コンストラクタ
|
---|
| 545 | */
|
---|
| 546 | Sub NotImplementedException()
|
---|
| 547 | SystemException("Not implemented.", Nothing)
|
---|
| 548 | HResult = E_NOTIMPL
|
---|
| 549 | End Sub
|
---|
| 550 | /*!
|
---|
| 551 | @biref コンストラクタ
|
---|
| 552 | @param[in] message エラーメッセージ
|
---|
| 553 | */
|
---|
| 554 | Sub NotImplementedException(message As String)
|
---|
| 555 | SystemException(message, Nothing)
|
---|
| 556 | HResult = E_NOTIMPL
|
---|
| 557 | End Sub
|
---|
| 558 | /*!
|
---|
| 559 | @biref コンストラクタ
|
---|
| 560 | @param[in] message エラーメッセージ
|
---|
| 561 | @param[in] innerException 内部例外
|
---|
| 562 | */
|
---|
| 563 | Sub NotImplementedException(message As String, innerException As Exception)
|
---|
| 564 | SystemException(message, innerException)
|
---|
| 565 | HResult = E_NOTIMPL
|
---|
| 566 | End Sub
|
---|
| 567 | End Class
|
---|
| 568 |
|
---|
| 569 | /*!
|
---|
| 570 | @brief 対応していないメソッド・関数ないし操作を行おうとしたことを表す例外
|
---|
| 571 | @author Egtra
|
---|
| 572 | @date 2007/11/19
|
---|
| 573 | */
|
---|
| 574 | Class NotSupportedException
|
---|
| 575 | Inherits SystemException
|
---|
| 576 | Public
|
---|
| 577 | /*!
|
---|
| 578 | @biref コンストラクタ
|
---|
| 579 | */
|
---|
| 580 | Sub NotSupportedException()
|
---|
| 581 | SystemException("This operation is not supported,", Nothing)
|
---|
[391] | 582 | HResult = ActiveBasic.AB_E_NOTSUPPORTED
|
---|
[385] | 583 | End Sub
|
---|
| 584 | /*!
|
---|
| 585 | @biref コンストラクタ
|
---|
| 586 | @param[in] message エラーメッセージ
|
---|
| 587 | */
|
---|
| 588 | Sub NotSupportedException(message As String)
|
---|
| 589 | SystemException(message, Nothing)
|
---|
[391] | 590 | HResult = ActiveBasic.AB_E_NOTSUPPORTED
|
---|
[385] | 591 | End Sub
|
---|
| 592 | /*!
|
---|
| 593 | @biref コンストラクタ
|
---|
| 594 | @param[in] message エラーメッセージ
|
---|
| 595 | @param[in] innerException 内部例外
|
---|
| 596 | */
|
---|
| 597 | Sub NotSupportedException(message As String, innerException As Exception)
|
---|
| 598 | SystemException(message, innerException)
|
---|
[391] | 599 | HResult = ActiveBasic.AB_E_NOTSUPPORTED
|
---|
[385] | 600 | End Sub
|
---|
| 601 | End Class
|
---|
| 602 |
|
---|
| 603 | /*!
|
---|
| 604 | @brief 実行しているプラットフォームで対応していないメソッド・関数ないし操作を行おうとしたことを表す例外
|
---|
| 605 | @author Egtra
|
---|
| 606 | @date 2007/11/19
|
---|
| 607 | */
|
---|
| 608 | Class PlatformNotSupportedException
|
---|
| 609 | Inherits NotSupportedException
|
---|
| 610 | Public
|
---|
| 611 | /*!
|
---|
| 612 | @biref コンストラクタ
|
---|
| 613 | */
|
---|
| 614 | Sub PlatformNotSupportedException()
|
---|
| 615 | NotSupportedException("This operation is not supported in this platform.", Nothing)
|
---|
[391] | 616 | HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
|
---|
[385] | 617 | End Sub
|
---|
| 618 | /*!
|
---|
| 619 | @biref コンストラクタ
|
---|
| 620 | @param[in] message エラーメッセージ
|
---|
| 621 | */
|
---|
| 622 | Sub PlatformNotSupportedException(message As String)
|
---|
| 623 | NotSupportedException(message, Nothing)
|
---|
[391] | 624 | HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
|
---|
[385] | 625 | End Sub
|
---|
| 626 | /*!
|
---|
| 627 | @biref コンストラクタ
|
---|
| 628 | @param[in] message エラーメッセージ
|
---|
| 629 | @param[in] innerException 内部例外
|
---|
| 630 | */
|
---|
| 631 | Sub PlatformNotSupportedException(message As String, innerException As Exception)
|
---|
| 632 | NotSupportedException(message, innerException)
|
---|
[391] | 633 | HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
|
---|
[385] | 634 | End Sub
|
---|
| 635 | End Class
|
---|
| 636 |
|
---|
| 637 | /*!
|
---|
| 638 | @brief 操作が取り止められたことを表す例外
|
---|
| 639 | @author Egtra
|
---|
| 640 | @date 2007/11/19
|
---|
| 641 | @todo HResultの調査
|
---|
| 642 | */
|
---|
| 643 | Class OperationCanceledException
|
---|
| 644 | Inherits SystemException
|
---|
| 645 | Public
|
---|
| 646 | /*!
|
---|
| 647 | @biref コンストラクタ
|
---|
| 648 | */
|
---|
| 649 | Sub OperationCanceledException()
|
---|
| 650 | SystemException("The operation was canceled.", Nothing)
|
---|
| 651 | End Sub
|
---|
| 652 | /*!
|
---|
| 653 | @biref コンストラクタ
|
---|
| 654 | @param[in] message エラーメッセージ
|
---|
| 655 | */
|
---|
| 656 | Sub OperationCanceledException(message As String)
|
---|
| 657 | SystemException(message, Nothing)
|
---|
| 658 | End Sub
|
---|
| 659 | /*!
|
---|
| 660 | @biref コンストラクタ
|
---|
| 661 | @param[in] message エラーメッセージ
|
---|
| 662 | @param[in] innerException 内部例外
|
---|
| 663 | */
|
---|
| 664 | Sub OperationCanceledException(message As String, innerException As Exception)
|
---|
| 665 | SystemException(message, innerException)
|
---|
| 666 | End Sub
|
---|
| 667 | End Class
|
---|
| 668 |
|
---|
| 669 | /*!
|
---|
| 670 | @brief メモリ不足例外
|
---|
| 671 | @author Egtra
|
---|
| 672 | @date 2007/11/19
|
---|
| 673 | @todo HResultの調査
|
---|
| 674 | */
|
---|
| 675 | Class OutOfMemoryException
|
---|
| 676 | Inherits SystemException
|
---|
| 677 | Public
|
---|
| 678 | /*!
|
---|
| 679 | @biref コンストラクタ
|
---|
| 680 | */
|
---|
| 681 | Sub OutOfMemoryException()
|
---|
| 682 | SystemException("Out of memory.", Nothing)
|
---|
| 683 | HResult = E_OUTOFMEMORY
|
---|
| 684 | End Sub
|
---|
| 685 | /*!
|
---|
| 686 | @biref コンストラクタ
|
---|
| 687 | @param[in] message エラーメッセージ
|
---|
| 688 | */
|
---|
| 689 | Sub OutOfMemoryException(message As String)
|
---|
| 690 | SystemException(message, Nothing)
|
---|
| 691 | HResult = E_OUTOFMEMORY
|
---|
| 692 | End Sub
|
---|
| 693 | /*!
|
---|
| 694 | @biref コンストラクタ
|
---|
| 695 | @param[in] message エラーメッセージ
|
---|
| 696 | @param[in] innerException 内部例外
|
---|
| 697 | */
|
---|
| 698 | Sub OutOfMemoryException(message As String, innerException As Exception)
|
---|
| 699 | SystemException(message, innerException)
|
---|
| 700 | HResult = E_OUTOFMEMORY
|
---|
| 701 | End Sub
|
---|
| 702 | End Class
|
---|
| 703 |
|
---|
| 704 |
|
---|
| 705 | End Namespace
|
---|