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