diff options
Diffstat (limited to 'src/core/Error.cpp')
-rw-r--r-- | src/core/Error.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/Error.cpp b/src/core/Error.cpp index 389e390736..2e699feeb9 100644 --- a/src/core/Error.cpp +++ b/src/core/Error.cpp @@ -28,7 +28,9 @@ #include <iostream> #include <stdexcept> -void arm_compute::error(const char *function, const char *file, const int line, const char *msg, ...) +using namespace arm_compute; + +Error arm_compute::create_error(ErrorCode error_code, const char *function, const char *file, const int line, const char *msg, ...) { char out[512]; va_list args; @@ -37,16 +39,14 @@ void arm_compute::error(const char *function, const char *file, const int line, vsnprintf(out + offset, sizeof(out) - offset, msg, args); va_end(args); - throw std::runtime_error(std::string(out)); + return Error(error_code, std::string(out)); } -void arm_compute::debug(const char *function, const char *file, const int line, const char *msg, ...) +void arm_compute::error(const char *function, const char *file, const int line, const char *msg, ...) { - char out[512]; va_list args; va_start(args, msg); - int offset = snprintf(out, sizeof(out), "in %s %s:%d: ", function, file, line); - vsnprintf(out + offset, sizeof(out) - offset, msg, args); + auto err = create_error(ErrorCode::RUNTIME_ERROR, function, file, line, msg, args); va_end(args); - std::cout << std::string(out) << std::endl; + throw std::runtime_error(err.description()); } |