summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Attribute.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2001-03-10 03:59:46 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2001-03-10 03:59:46 (GMT)
commit9cd9f7f5216fbc30b10426f5bd11e26d81668eac (patch)
treebe3e4f25e5a870f8e98c7b1cfce3917a5dd19269 /c++/src/H5Attribute.cpp
parentcd29e12e0252ccfc969281c5dabd991b46203f05 (diff)
downloadhdf5-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/H5Attribute.cpp')
-rw-r--r--c++/src/H5Attribute.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 03b50b9..de184a5 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -29,7 +29,7 @@ void Attribute::write( const DataType& mem_type, void *buf ) const
herr_t ret_value = H5Awrite( id, mem_type.getId(), buf );
if( ret_value < 0 )
{
- throw AttributeIException();
+ throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
@@ -39,7 +39,7 @@ void Attribute::read( const DataType& mem_type, void *buf ) const
herr_t ret_value = H5Aread( id, mem_type.getId(), buf );
if( ret_value < 0 )
{
- throw AttributeIException();
+ throw AttributeIException("Attribute::read", "H5Aread failed");
}
}
@@ -57,7 +57,7 @@ DataSpace Attribute::getSpace() const
}
else
{
- throw AttributeIException();
+ throw AttributeIException("Attribute::getSpace", "H5Aget_space failed");
}
}
@@ -72,7 +72,7 @@ hid_t Attribute::p_getType() const
return( type_id );
else
{
- throw AttributeIException();
+ throw AttributeIException(NULL, "H5Aget_type failed");
}
}
@@ -87,7 +87,7 @@ string Attribute::getName( size_t buf_size ) const
// If H5Aget_name returns a negative value, raise an exception,
if( name_size < 0 )
{
- throw AttributeIException();
+ throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
// otherwise, create the string to hold the attribute name and return it
string name = string( name_C );
@@ -102,7 +102,7 @@ void Attribute::p_close() const
herr_t ret_value = H5Aclose( id );
if( ret_value < 0 )
{
- throw AttributeIException();
+ throw AttributeIException(NULL, "H5Aclose failed");
}
}
@@ -114,7 +114,11 @@ void Attribute::p_close() const
Attribute::~Attribute()
{
// The attribute id will be closed properly
- resetIdComponent( this );
+ try {
+ resetIdComponent( this ); }
+ catch (Exception close_error) { // thrown by p_close
+ throw AttributeIException("Attribute::~Attribute", close_error.getDetailMsg());
+ }
}
#ifndef H5_NO_NAMESPACE