| 8 | static CustomErrorCallback custom_error_callback = nullptr; |
| 9 | |
| 10 | Error format_error(const char* source_file, int source_line, const char* format, ...) |
| 11 | { |
| 12 | va_list args; |
| 13 | va_start(args, format); |
| 14 | |
| 15 | char message[4096]; |
| 16 | if(vsnprintf(message, sizeof(message), format, args) < 0) { |
| 17 | strncpy(message, "Failed to generate error message.", sizeof(message)); |
| 18 | } |
| 19 | |
| 20 | Error error; |
| 21 | error.message = message; |
| 22 | error.source_file = source_file; |
| 23 | error.source_line = source_line; |
| 24 | |
| 25 | va_end(args); |
| 26 | return error; |
| 27 | } |
| 28 | |
| 29 | void report_error(const Error& error) |
| 30 | { |
no outgoing calls
no test coverage detected