Remove SDL2

This commit is contained in:
2025-07-22 14:21:23 -05:00
parent e870773fe2
commit 374e34d896
61 changed files with 54 additions and 6457 deletions

View File

@@ -300,14 +300,14 @@ namespace Tesses::Framework::Http
void DownloadUnixSocketToStreamSimple(std::string unixSocket,std::string url, Tesses::Framework::Streams::Stream* strm)
{
if(strm == nullptr) throw TextException("strm is null");
if(strm == nullptr) throw std::runtime_error("strm is null");
HttpRequest request;
request.url = url;
request.unixSocket = unixSocket;
request.followRedirects=true;
request.method = "GET";
HttpResponse response(request);
if(response.statusCode < 200 || response.statusCode > 299) throw TextException("Status code does not indicate success: " + std::to_string(response.statusCode) + " " + HttpUtils::StatusCodeString(response.statusCode));
if(response.statusCode < 200 || response.statusCode > 299) throw std::runtime_error("Status code does not indicate success: " + std::to_string(response.statusCode) + " " + HttpUtils::StatusCodeString(response.statusCode));
response.CopyToStream(strm);
}
void DownloadUnixSocketToStreamSimple(std::string unixSocket,std::string url, Tesses::Framework::Streams::Stream& strm)
@@ -317,16 +317,16 @@ namespace Tesses::Framework::Http
void DownloadUnixSocketToFileSimple(std::string unixSocket,std::string url, Tesses::Framework::Filesystem::VFS* vfs, Tesses::Framework::Filesystem::VFSPath path)
{
if(vfs == nullptr) throw TextException("vfs is null");
if(vfs == nullptr) throw std::runtime_error("vfs is null");
auto strm = vfs->OpenFile(path,"wb");
if(strm == nullptr) throw TextException("strm is null");
if(strm == nullptr) throw std::runtime_error("strm is null");
DownloadUnixSocketToStreamSimple(unixSocket,url,strm);
delete strm;
}
void DownloadUnixSocketToFileSimple(std::string unixSocket,std::string url, Tesses::Framework::Filesystem::VFS& vfs, Tesses::Framework::Filesystem::VFSPath path)
{
auto strm = vfs.OpenFile(path,"wb");
if(strm == nullptr) throw TextException("strm is null");
if(strm == nullptr) throw std::runtime_error("strm is null");
DownloadUnixSocketToStreamSimple(unixSocket,url,strm);
delete strm;
}
@@ -342,7 +342,7 @@ namespace Tesses::Framework::Http
request.followRedirects=true;
request.method = "GET";
HttpResponse response(request);
if(response.statusCode < 200 || response.statusCode > 299) throw TextException("Status code does not indicate success: " + std::to_string(response.statusCode) + " " + HttpUtils::StatusCodeString(response.statusCode));
if(response.statusCode < 200 || response.statusCode > 299) throw std::runtime_error("Status code does not indicate success: " + std::to_string(response.statusCode) + " " + HttpUtils::StatusCodeString(response.statusCode));
return response.ReadAsString();
}
void DownloadToStreamSimple(std::string url, Tesses::Framework::Streams::Stream* strm)
@@ -373,7 +373,7 @@ namespace Tesses::Framework::Http
request.followRedirects=true;
request.method = "GET";
HttpResponse response(request);
if(response.statusCode < 200 || response.statusCode > 299) throw TextException("Status code does not indicate success: " + std::to_string(response.statusCode) + " " + HttpUtils::StatusCodeString(response.statusCode));
if(response.statusCode < 200 || response.statusCode > 299) throw std::runtime_error("Status code does not indicate success: " + std::to_string(response.statusCode) + " " + HttpUtils::StatusCodeString(response.statusCode));
return response.ReadAsString();
}

View File

@@ -730,8 +730,8 @@ namespace Tesses::Framework::Http
void ServerContext::SendStream(Stream& strm)
{
if(sent) return;
if(!strm.CanRead()) throw TextException("Cannot read from stream");
if(strm.EndOfStream()) throw TextException("End of stream");
if(!strm.CanRead()) throw std::runtime_error("Cannot read from stream");
if(strm.EndOfStream()) throw std::runtime_error("End of stream");
if(strm.CanSeek())
{
int64_t len=strm.GetLength();
@@ -1013,13 +1013,24 @@ namespace Tesses::Framework::Http
ctx.SendNotFound();
}
}
catch(std::exception& ex)
{
ctx.SendException(ex);
}
catch(std::string& ex)
{
std::runtime_error re(ex);
ctx.SendException(re);
}
catch(const char* ex)
{
std::runtime_error re(ex);
ctx.SendException(re);
}
catch(...)
{
TextException ex("An unknown error occurred");
std::runtime_error ex("An unknown error occurred");
ctx.SendException(ex);
}