diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2001-03-10 03:59:46 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2001-03-10 03:59:46 (GMT) |
commit | 9cd9f7f5216fbc30b10426f5bd11e26d81668eac (patch) | |
tree | be3e4f25e5a870f8e98c7b1cfce3917a5dd19269 /c++/src/H5PropList.cpp | |
parent | cd29e12e0252ccfc969281c5dabd991b46203f05 (diff) | |
download | hdf5-9cd9f7f5216fbc30b10426f5bd11e26d81668eac.zip hdf5-9cd9f7f5216fbc30b10426f5bd11e26d81668eac.tar.gz hdf5-9cd9f7f5216fbc30b10426f5bd11e26d81668eac.tar.bz2 |
[svn-r3602]
Purpose: Usability enhancement
Description:
- Added more information about the failure to all the throw's,
i.e, member function name and more detail about the failure, where
appropriate. Also, added exception throws for private functions,
such as p_close to provide more specific details.
- Added two api functions: Exception::getFuncName() and
Exception::getCFuncName() to provide the name of the member
function where failure occurs.
- Fixed some typos, one of which caused segn. fault in some
situations (resetIdComponent was accidentally called twice
in a couple of places :)
Platforms:
arabica (sparc-sun-solaris 2.7)
Diffstat (limited to 'c++/src/H5PropList.cpp')
-rw-r--r-- | c++/src/H5PropList.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index ad9c8ca..8609b60 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -24,7 +24,7 @@ PropList::PropList( H5P_class_t type ) : IdComponent( 0 ) id = H5Pcreate(type ); if( id <= 0 ) { - throw PropListIException(); + throw PropListIException("PropList constructor", "H5Pcreate failed"); } } @@ -46,7 +46,11 @@ void PropList::copy( const PropList& like_plist ) { // reset the identifier of this PropList - send 'this' in so that // H5Pclose can be called appropriately - resetIdComponent( this ); + try { + resetIdComponent( this ); } + catch (Exception close_error) { // thrown by p_close + throw PropListIException("PropList::copy", close_error.getDetailMsg()); + } // call C routine to copy the property list id = H5Pcopy( like_plist.getId() ); @@ -56,7 +60,7 @@ void PropList::copy( const PropList& like_plist ) if( id <= 0 ) { - throw PropListIException(); + throw PropListIException("PropList::copy", "H5Pcopy failed"); } } @@ -68,7 +72,7 @@ void PropList::p_close() const herr_t ret_value = H5Pclose( id ); if( ret_value < 0 ) { - throw PropListIException("PropList::p_close: unable to close the property list. Please report this bug to HDF." ); + throw PropListIException(NULL, "H5Pclose failed" ); } } } @@ -79,7 +83,8 @@ H5P_class_t PropList::getClass() const H5P_class_t plist_class = H5Pget_class( id ); if( plist_class == H5P_NO_CLASS ) { - throw PropListIException(); + throw PropListIException("PropList::getClass", + "H5Pget_class failed - returned H5P_NO_CLASS"); } return( plist_class ); } @@ -89,7 +94,11 @@ H5P_class_t PropList::getClass() const PropList::~PropList() { // The property list id will be closed properly - resetIdComponent( this ); + try { + resetIdComponent( this ); } + catch (Exception close_error) { // thrown by p_close + throw PropListIException("PropList::~PropList", close_error.getDetailMsg()); + } } #ifndef H5_NO_NAMESPACE |