Austin Schuh | d9e9dea | 2022-02-20 19:54:42 -0800 | [diff] [blame] | 1 | #include "osqp_error.h" |
Austin Schuh | 9049e20 | 2022-02-20 17:34:16 -0800 | [diff] [blame] | 2 | |
| 3 | const char *OSQP_ERROR_MESSAGE[] = { |
| 4 | "Problem data validation.", |
| 5 | "Solver settings validation.", |
| 6 | "Linear system solver not available.\nTried to obtain it from shared library.", |
| 7 | "Linear system solver initialization.", |
| 8 | "KKT matrix factorization.\nThe problem seems to be non-convex.", |
| 9 | "Memory allocation.", |
| 10 | "Solver workspace not initialized.", |
| 11 | }; |
| 12 | |
| 13 | |
| 14 | c_int _osqp_error(enum osqp_error_type error_code, |
| 15 | const char * function_name) { |
| 16 | # ifdef PRINTING |
| 17 | c_print("ERROR in %s: %s\n", function_name, OSQP_ERROR_MESSAGE[error_code-1]); |
Austin Schuh | d9e9dea | 2022-02-20 19:54:42 -0800 | [diff] [blame] | 18 | # else |
| 19 | (void)function_name; |
Austin Schuh | 9049e20 | 2022-02-20 17:34:16 -0800 | [diff] [blame] | 20 | # endif |
| 21 | return (c_int)error_code; |
| 22 | } |
| 23 | |