send better error message in c++, pass along in py
parent
48b513fc42
commit
99d478f87e
|
@ -143,8 +143,7 @@ createAccessor_C(PyObject* self, PyObject* args)
|
|||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
std::cerr << e.what() << '\n';
|
||||
PyErr_SetString(PyExc_OSError, "Failed to created DataAccessor.");
|
||||
PyErr_SetString(PyExc_OSError, e.what());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,19 +72,19 @@ GDALAccessor::openFile (string filename, string accessMode, GDALDataset ** fd)
|
|||
(*fd) = (GDALDataset *) GDALOpenShared (filename.c_str (), GA_ReadOnly);
|
||||
if ((*fd) == NULL)
|
||||
{
|
||||
cout << "Error. Cannot open the file " << filename << " in "
|
||||
<< accessMode << " mode." << endl;
|
||||
throw runtime_error("GDAL file open error.");
|
||||
string errMsg = "Cannot open the file " + filename + " in "
|
||||
+ accessMode + " mode.";
|
||||
throw runtime_error(errMsg);
|
||||
// ERR_MESSAGE
|
||||
;
|
||||
// ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Error. Only read mode is available and not " << accessMode
|
||||
<< " mode." << endl;
|
||||
ERR_MESSAGE
|
||||
;
|
||||
string errMsg = "Error. Only read mode is available and not " + accessMode + " mode.";
|
||||
throw runtime_error(errMsg);
|
||||
// ERR_MESSAGE
|
||||
// ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue