/*! @file @brief System.IOに属す例外クラスの定義 */ Namespace ActiveBasic Const AB_E_IO = &h80041620 '80131620 Const AB_E_FILENOTFOUND = STG_E_FILENOTFOUND '0x80070002 End Namespace Namespace System Namespace IO /*! @brief IO処理に関する例外のクラス @author Egtra @date 2007/12/06 */ Class IOException Inherits SystemException Public /*! @biref コンストラクタ */ Sub IOException() SystemException(GetType().FullName) HResult = ActiveBasic.AB_E_IO End Sub /*! @biref コンストラクタ @param[in] message エラーメッセージ */ Sub IOException(message As String) SystemException(message) HResult = ActiveBasic.AB_E_IO End Sub /*! @biref コンストラクタ @param[in] message エラーメッセージ @param[in] innerException 内部例外 */ Sub IOException(message As String, innerException As Exception) SystemException(message, innerException) HResult = ActiveBasic.AB_E_IO End Sub /*! @biref コンストラクタ @param[in] message エラーメッセージ @param[in] hr HRESULT例外値 */ Sub IOException(message As String, hr As HRESULT) SystemException(message) HResult = hr End Sub End Class Namespace Detail /*! @brief Windowsエラー値を基にIOExceptionを投げる。 @param[in] message エラーメッセージ @param[in] error エラーコード @author Egtra @date 2007/12/06 */ Sub ThrowWinIOException(msg As String, error As DWord) Throw GetWinIOException(msg, error) End Sub /*! @brief Windowsエラー値を基にIOExceptionインスタンスを作成する。 @param[in] message エラーメッセージ @param[in] error エラーコード @return 作成されたIOExceptionインスタンス @author Egtra @date 2008/08/21 */ Function GetWinIOException(msg As String, error As DWord) As IOException Return New IOException(msg, HRESULT_FROM_WIN32(error)) End Function /*! @brief GetLastError()の値を基にIOExceptionを投げる。 @param[in] message エラーメッセージ @author Egtra @date 2007/12/06 */ Sub ThrowWinLastErrorIOException(msg = Nothing As String) Throw GetWinLastErrorIOException(msg) End Sub /*! @brief GetLastError()の値を基にIOExceptionインスタンスを作成する。 @param[in] message エラーメッセージ @return 作成されたIOExceptionインスタンス @author Egtra @date 2008/08/21 */ Function GetWinLastErrorIOException(msg As String) As IOException Return New IOException(msg, HRESULT_FROM_WIN32(GetLastError())) End Function End Namespace /*! @brief ディスク上に指定したファイル名が見つからない際の例外 @author NoWest @date 2008/08/11 */ Class FileNotFoundException Inherits SystemException Public /*! @biref コンストラクタ */ Sub FileNotFoundException() SystemException(GetType().FullName) HResult = ActiveBasic.AB_E_FILENOTFOUND End Sub /*! @biref コンストラクタ @param[in] message エラーメッセージ */ Sub FileNotFoundException(message As String) SystemException(message) HResult = ActiveBasic.AB_E_FILENOTFOUND End Sub /*! @biref コンストラクタ @param[in] message エラーメッセージ @param[in] innerException 内部例外 */ Sub FileNotFoundException(message As String, innerException As Exception) SystemException(message, innerException) HResult = ActiveBasic.AB_E_FILENOTFOUND End Sub End Class End Namespace 'IO End Namespace 'System