Skip to content

Commit 48467b2

Browse files
committed
Improved error messages
1 parent fefe428 commit 48467b2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/matioCpp/impl/EigenConversions.tpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ namespace matioCpp
2424
template <typename type>
2525
SlicingInfo computeSlicingInfo(const matioCpp::MultiDimensionalArray<type>& input, const std::vector<int>& slice)
2626
{
27+
std::string errorPrefix = "[ERROR][matioCpp::to_eigen] ";
28+
2729
using index_type = typename matioCpp::MultiDimensionalArray<type>::index_type;
2830
SlicingInfo info;
2931

3032
const auto& dimensions = input.dimensions();
3133

3234
if (slice.size() != dimensions.size())
3335
{
34-
std::cerr << "The number of slices must be equal to the number of dimensions of the input MultiDimensionalArray" << std::endl;
36+
std::cerr << errorPrefix << "The number of slices must be equal to the number of dimensions of the input MultiDimensionalArray" << std::endl;
3537
assert(false);
3638
return info;
3739
}
@@ -45,7 +47,7 @@ namespace matioCpp
4547
{
4648
if (slice[i] >= dimensions(i))
4749
{
48-
std::cerr << "The slice is larger than the dimension of the input MultiDimensionalArray" << std::endl;
50+
std::cerr << errorPrefix << "The slice is larger than the dimension of the input MultiDimensionalArray" << std::endl;
4951
assert(false);
5052
return SlicingInfo();
5153
}
@@ -65,7 +67,7 @@ namespace matioCpp
6567
}
6668
else
6769
{
68-
std::cerr << "Only at most two free dimensions are allowed" << std::endl;
70+
std::cerr << errorPrefix << "Only at most two free dimensions are allowed" << std::endl;
6971
assert(false);
7072
return SlicingInfo();
7173
}

0 commit comments

Comments
 (0)