diff --git a/modules/core/src/bindings_utils.cpp b/modules/core/src/bindings_utils.cpp index 78093002f7..6191f26f7c 100644 --- a/modules/core/src/bindings_utils.cpp +++ b/modules/core/src/bindings_utils.cpp @@ -9,7 +9,12 @@ #include #include -namespace cv { namespace utils { +namespace cv { +static inline std::ostream& operator<<(std::ostream& os, const Rect& rect) +{ + return os << "[x=" << rect.x << ", y=" << rect.y << ", w=" << rect.width << ", h=" << rect.height << ']'; +} +namespace utils { String dumpInputArray(InputArray argument) { @@ -51,9 +56,13 @@ String dumpInputArray(InputArray argument) ss << " type(-1)=" << cv::typeToString(argument.type(-1)); } while (0); } + catch (const std::exception& e) + { + ss << " ERROR: exception occurred: " << e.what(); + } catch (...) { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds + ss << " ERROR: unknown exception occurred, dump is non-complete"; } return ss.str(); } @@ -104,9 +113,13 @@ CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument) } } while (0); } + catch (const std::exception& e) + { + ss << " ERROR: exception occurred: " << e.what(); + } catch (...) { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds + ss << " ERROR: unknown exception occurred, dump is non-complete"; } return ss.str(); } @@ -151,9 +164,13 @@ CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument) ss << " type(-1)=" << cv::typeToString(argument.type(-1)); } while (0); } + catch (const std::exception& e) + { + ss << " ERROR: exception occurred: " << e.what(); + } catch (...) { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds + ss << " ERROR: unknown exception occurred, dump is non-complete"; } return ss.str(); } @@ -204,28 +221,28 @@ CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argume } } while (0); } + catch (const std::exception& e) + { + ss << " ERROR: exception occurred: " << e.what(); + } catch (...) { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds + ss << " ERROR: unknown exception occurred, dump is non-complete"; } return ss.str(); } -static inline std::ostream& operator<<(std::ostream& os, const cv::Rect& rect) -{ - return os << "[x=" << rect.x << ", y=" << rect.y << ", w=" << rect.width << ", h=" << rect.height << ']'; -} - template static inline String dumpVector(const std::vector& vec, Formatter format) { std::ostringstream oss("[", std::ios::ate); if (!vec.empty()) { - oss << format << vec[0]; + format(oss) << vec[0]; for (std::size_t i = 1; i < vec.size(); ++i) { - oss << ", " << format << vec[i]; + oss << ", "; + format(oss) << vec[i]; } } oss << "]";