Skip to content

Commit

Permalink
Merge pull request #1 from duckdb/exceptioncatchfix
Browse files Browse the repository at this point in the history
HTTPException no longer inherits from IOException
  • Loading branch information
carlopi authored Oct 29, 2024
2 parents ee6f3d2 + 5349ac1 commit 5546f3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions extension/httpfs/httpfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ HTTPFileSystem::RunRequestWithRetry(const std::function<duckdb_httplib_openssl::
}
} catch (IOException &e) {
caught_e = std::current_exception();
} catch (HTTPException &e) {
caught_e = std::current_exception();
}

// Note: all duckdb_httplib_openssl::Error types will be retried.
Expand Down
7 changes: 5 additions & 2 deletions extension/httpfs/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,11 @@ void S3FileSystem::UploadBuffer(S3FileHandle &file_handle, shared_ptr<S3WriteBuf
throw IOException("Unexpected response when uploading part to S3");
}

} catch (IOException &ex) {
} catch (std::exception &ex) {
ErrorData error(ex);
if (error.Type() != ExceptionType::IO && error.Type() != ExceptionType::HTTP) {
throw;
}
// Ensure only one thread sets the exception
bool f = false;
auto exchanged = file_handle.uploader_has_error.compare_exchange_strong(f, true);
Expand All @@ -333,7 +337,6 @@ void S3FileSystem::UploadBuffer(S3FileHandle &file_handle, shared_ptr<S3WriteBuf
}

NotifyUploadsInProgress(file_handle);

return;
}

Expand Down

0 comments on commit 5546f3a

Please sign in to comment.