From 23824a3cf5e0e1d9a1074479ef69d8c83139a99d Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 13 May 2025 21:53:26 +0200 Subject: [PATCH] Use HTTPException for HTTP errors in GetRequest and GetRangeRequest Instead of IOExceptions --- extension/httpfs/httpfs.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extension/httpfs/httpfs.cpp b/extension/httpfs/httpfs.cpp index 4c910655..9c6763e8 100644 --- a/extension/httpfs/httpfs.cpp +++ b/extension/httpfs/httpfs.cpp @@ -171,7 +171,7 @@ unique_ptr HTTPFileSystem::GetRequest(FileHandle &handle, string u error += " This could mean the file was changed. Try disabling the duckdb http metadata cache " "if enabled, and confirm the server supports range requests."; } - throw IOException(error); + throw HTTPException(error); } return true; }, @@ -230,8 +230,8 @@ unique_ptr HTTPFileSystem::GetRangeRequest(FileHandle &handle, str if (response.HasHeader("Content-Length")) { auto content_length = stoll(response.GetHeaderValue("Content-Length")); if ((idx_t)content_length != buffer_out_len) { - throw IOException("HTTP GET error: Content-Length from server mismatches requested " - "range, server may not support range requests."); + throw HTTPException("HTTP GET error: Content-Length from server mismatches requested " + "range, server may not support range requests."); } } } @@ -245,8 +245,8 @@ unique_ptr HTTPFileSystem::GetRangeRequest(FileHandle &handle, str // behaviour, so we have to improve logic elsewhere to properly handle this case. // To avoid corruption of memory, we bail out. - throw IOException("Server sent back more data than expected, `SET force_download=true` might " - "help in this case"); + throw HTTPException("Server sent back more data than expected, `SET force_download=true` might " + "help in this case"); } memcpy(buffer_out + out_offset, data, data_length); out_offset += data_length;