Add error codes

This commit is contained in:
2025-11-26 22:38:37 +01:00
parent a58dc241ef
commit c4c41653f4
16 changed files with 483 additions and 713 deletions
+14
View File
@@ -94,3 +94,17 @@ void print_bytes(HTTP_String prefix, HTTP_String src)
}
putc('\n', stream);
}
char *http_strerror(int code)
{
switch (code) {
case HTTP_OK: return "No error";
case HTTP_ERROR_UNSPECIFIED: return "Unspecified error";
case HTTP_ERROR_OOM: return "Out of memory";
case HTTP_ERROR_BADURL: return "Invalid URL";
case HTTP_ERROR_REQLIMIT: return "Parallel request limit reached";
case HTTP_ERROR_BADHANDLE: return "Invalid handle";
case HTTP_ERROR_NOTLS: return "TLS support not built-in";
}
return "???";
}