standard_errors.h
Go to the documentation of this file.
1 /*
2 * ECVL - European Computer Vision Library
3 * Version: 0.3.4
4 * copyright (c) 2021, Università degli Studi di Modena e Reggio Emilia (UNIMORE), AImageLab
5 * Authors:
6 * Costantino Grana (costantino.grana@unimore.it)
7 * Federico Bolelli (federico.bolelli@unimore.it)
8 * Michele Cancilla (michele.cancilla@unimore.it)
9 * Laura Canalini (laura.canalini@unimore.it)
10 * Stefano Allegretti (stefano.allegretti@unimore.it)
11 * All rights reserved.
12 */
13 
14 #ifndef ECVL_STANDARD_ERRORS_H_
15 #define ECVL_STANDARD_ERRORS_H_
16 
17 #include <stdexcept>
18 
19 #define ECVL_ERROR_MSG "[Error]: "
20 #define ECVL_WARNING_MSG "[Warning]: "
21 
22 #define ECVL_ERROR_NOT_IMPLEMENTED throw std::runtime_error(ECVL_ERROR_MSG "Not implemented");
23 #define ECVL_ERROR_NOT_IMPLEMENTED_WHAT(what) throw std::runtime_error(ECVL_ERROR_MSG what " not implemented");
24 #define ECVL_ERROR_NOT_REACHABLE_CODE throw std::runtime_error(ECVL_ERROR_MSG "How did you get here?");
25 #define ECVL_ERROR_WRONG_PARAMS(msg) throw std::runtime_error(ECVL_ERROR_MSG "Wrong parameters - " msg);
26 #define ECVL_ERROR_NOT_ALLOWED_ON_NON_OWING_IMAGE(...) throw std::runtime_error(ECVL_ERROR_MSG "Operation not allowed on non-owning Image" __VA_ARGS__);
27 #define ECVL_ERROR_UNSUPPORTED_OPENCV_DEPTH throw std::runtime_error(ECVL_ERROR_MSG "Unsupported OpenCV depth");
28 #define ECVL_ERROR_UNSUPPORTED_OPENCV_DIMS throw std::runtime_error(ECVL_ERROR_MSG "Unsupported OpenCV dimensions");
29 #define ECVL_ERROR_UNSUPPORTED_SRC_DATATYPE throw std::runtime_error(ECVL_ERROR_MSG "The src DataType is not supported by this function");
30 #define ECVL_ERROR_UNSUPPORTED_SRC_COLORTYPE throw std::runtime_error(ECVL_ERROR_MSG "The src ColorType is not supported by this function");
31 #define ECVL_ERROR_EMPTY_IMAGE throw std::runtime_error(ECVL_ERROR_MSG "Empty image provided");
32 #define ECVL_ERROR_NOT_ALLOWED_ON_UNSIGNED_IMG throw std::runtime_error(ECVL_ERROR_MSG "Operation not allowed on unsigned Image");
33 #define ECVL_ERROR_DIVISION_BY_ZERO throw std::runtime_error(ECVL_ERROR_MSG "Division by zero is not allowed.");
34 #define ECVL_ERROR_FILE_DOES_NOT_EXIST throw std::runtime_error(ECVL_ERROR_MSG "File does not exist");
35 #define ECVL_ERROR_SPLIT_DOES_NOT_EXIST throw std::runtime_error(ECVL_ERROR_MSG "This split does not exist in the dataset file");
36 #define ECVL_ERROR_CANNOT_LOAD_FROM_URL throw std::runtime_error(ECVL_ERROR_MSG "Cannot load from URL");
37 #define ECVL_ERROR_CANNOT_LOAD_IMAGE throw std::runtime_error(ECVL_ERROR_MSG "Cannot load image");
38 #define ECVL_ERROR_INCOMPATIBLE_DIMENSIONS throw std::runtime_error(ECVL_ERROR_MSG "Incompatible dimensions");
39 #define ECVL_ERROR_DIFFERENT_DEVICES throw std::runtime_error(ECVL_ERROR_MSG "src and dst are in different devices");
40 #define ECVL_ERROR_DEVICE_UNAVAILABLE(device) throw std::runtime_error(ECVL_ERROR_MSG #device " device unavailable");
41 #define ECVL_ERROR_MOVING_IMAGE(str, device) throw std::runtime_error(ECVL_ERROR_MSG "Cannot move " #str " " #device);
42 
43 
44 #endif // ECVL_STANDARD_ERRORS_H_