// retoor <retoor@molodetz.nl>
#include "r_error.h"
static const char *error_messages[] = {
[R_SUCCESS] = "Success",
[R_ERROR_INVALID_ARG] = "Invalid argument",
[R_ERROR_OUT_OF_MEMORY] = "Out of memory",
[R_ERROR_NOT_FOUND] = "Not found",
[R_ERROR_PARSE] = "Parse error",
[R_ERROR_DB_CONNECTION] = "Database connection failed",
[R_ERROR_DB_QUERY] = "Database query failed",
[R_ERROR_DB_NOT_FOUND] = "Database key not found",
[R_ERROR_HTTP_CONNECTION] = "HTTP connection failed",
[R_ERROR_HTTP_TIMEOUT] = "HTTP request timed out",
[R_ERROR_HTTP_RESPONSE] = "HTTP response error",
[R_ERROR_JSON_PARSE] = "JSON parse error",
[R_ERROR_FILE_NOT_FOUND] = "File not found",
[R_ERROR_FILE_READ] = "File read error",
[R_ERROR_FILE_WRITE] = "File write error",
[R_ERROR_TOOL_NOT_FOUND] = "Tool not found",
[R_ERROR_TOOL_EXECUTION] = "Tool execution failed",
[R_ERROR_API_KEY_MISSING] = "API key missing",
[R_ERROR_API_ERROR] = "API error",
[R_ERROR_MAX_ITERATIONS] = "Maximum iterations reached",
[R_ERROR_SESSION_INVALID] = "Invalid session name",
[R_ERROR_UNKNOWN] = "Unknown error"
};
const char *r_status_string(r_status_t status) {
if (status < 0 || status > R_ERROR_UNKNOWN) {
return error_messages[R_ERROR_UNKNOWN];
}
return error_messages[status];
}