WSL/SLF GitLab Repository

Commit 2f9d3084 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Improved some error messages and improved consistency of error messages

parent 5a196216
......@@ -183,7 +183,7 @@ template<class T> inline T& Array1D<T>::operator()(const unsigned int& index) {
if (index >= nx) {
std::stringstream ss;
ss << "Trying to access array(" << index << ")";
ss << " while array is [" << nx << "]";
ss << " while array is (" << nx << ")";
throw IndexOutOfBoundsException(ss.str(), AT);
}
#endif
......@@ -195,7 +195,7 @@ template<class T> inline const T Array1D<T>::operator()(const unsigned int& inde
if (index >= nx) {
std::stringstream ss;
ss << "Trying to access array(" << index << ")";
ss << " while array is [" << nx << "]";
ss << " while array is (" << nx << ")";
throw IndexOutOfBoundsException(ss.str(), AT);
}
#endif
......
......@@ -232,7 +232,7 @@ template<class T> inline T& Array2D<T>::operator()(const unsigned int& x, const
if ((x >= nx) || (y >= ny)) {
std::stringstream ss;
ss << "Trying to access array(" << x << "," << y << ")";
ss << " while array is [" << nx << "," << ny << "]";
ss << " while array is (" << nx << "," << ny << ")";
throw IndexOutOfBoundsException(ss.str(), AT);
}
#endif
......@@ -245,7 +245,7 @@ template<class T> inline const T Array2D<T>::operator()(const unsigned int& x, c
if ((x >= nx) || (y >= ny)) {
std::stringstream ss;
ss << "Trying to access array(" << x << "," << y << ")";
ss << " while array is [" << nx << "," << ny << "]";
ss << " while array is (" << nx << "," << ny << ")";
throw IndexOutOfBoundsException(ss.str(), AT);
}
#endif
......
......@@ -268,7 +268,7 @@ template<class T> inline T& Array3D<T>::operator()(const unsigned int& x, const
if ((x >= nx) || (y >= ny) || (z >= nz)) {
std::stringstream ss;
ss << "Trying to access array(" << x << "," << y << "," << z << ")";
ss << " while array is [" << nx << "," << ny << "," << nz << "]";
ss << " while array is (" << nx << "," << ny << "," << nz << ")";
throw IndexOutOfBoundsException(ss.str(), AT);
}
#endif
......@@ -282,7 +282,7 @@ template<class T> inline const T Array3D<T>::operator()(const unsigned int& x, c
if ((x >= nx) || (y >= ny) || (z >= nz)) {
std::stringstream ss;
ss << "Trying to access array(" << x << "," << y << "," << z << ")";
ss << " while array is [" << nx << "," << ny << "," << nz << "]";
ss << " while array is (" << nx << "," << ny << "," << nz << ")";
throw IndexOutOfBoundsException(ss.str(), AT);
}
#endif
......
......@@ -214,7 +214,10 @@ void Grid2DObject::set(const unsigned int& i_ncols, const unsigned int& i_nrows,
{
//Test for equality in size: Only compatible Array2D<double> grids are permitted
if ((i_ncols != i_grid2D.getNx()) || (i_nrows != i_grid2D.getNy())) {
throw IOException("Mismatch in size of Array2D<double> parameter _grid2D and size of Grid2DObject", AT);
std::stringstream ss;
ss << "Trying to initialize a ( " << i_ncols << " x " << i_nrows << " ) Grid2DObject with a ";
ss << "( " << i_grid2D.getNx() << " x " << i_grid2D.getNy() << " ) 2D array";
throw IOException(ss.str(), AT);
}
setValues(i_ncols, i_nrows, i_cellsize, i_llcorner);
......
......@@ -232,7 +232,10 @@ void Grid3DObject::set(const unsigned int& i_ncols, const unsigned int& i_nrows,
{
//Test for equality in size: Only compatible Array3D<double> grids are permitted
if ((i_ncols != i_grid3D.getNx()) || (i_nrows != i_grid3D.getNy()) || (i_ndepths != i_grid3D.getNz())) {
throw IOException("Mismatch in size of Array3D<double> parameter grid3D and size of Grid3DObject", AT);
std::stringstream ss;
ss << "Trying to initialize a ( " << i_ncols << " x " << i_nrows << " x " << i_ndepths << " ) Grid3DObject with a ";
ss << "( " << i_grid3D.getNx() << " x " << i_grid3D.getNy() << " x " << i_grid3D.getNz() << " ) 3D array";
throw IOException(ss.str(), AT);
}
setValues(i_ncols, i_nrows, i_ndepths, i_cellsize, i_llcorner);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment