summaryrefslogtreecommitdiffstats
path: root/c++/examples/extend_ds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/examples/extend_ds.cpp')
-rw-r--r--c++/examples/extend_ds.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp
index f748cde..34a50c3 100644
--- a/c++/examples/extend_ds.cpp
+++ b/c++/examples/extend_ds.cpp
@@ -40,10 +40,18 @@ const int RANK = 2;
int main (void)
{
- // Try block to detect exceptions raised by any of the calls inside it
+ /*
+ * Try block to detect exceptions raised by any of the calls inside it
+ */
try
{
/*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
* Create the data space with unlimited dimensions.
*/
hsize_t dims[2] = { 3, 3}; // dataset dimensions at creation
@@ -192,24 +200,28 @@ int main (void)
catch( FileIException error )
{
error.printError();
+ return -1;
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
error.printError();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
error.printError();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch( DataTypeIException error )
{
error.printError();
+ return -1;
}
return 0;
}