feat: expose Gemini RetryInfo retry_delay() on VertexApiError and Error (#19) #20
Reference in New Issue
Block a user
Delete Branch "feat/retry-delay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #19
Changes
src/types/error.rs:VertexApiError.detailsis nowOption<Vec<serde_json::Value>>. Previously a429 RESOURCE_EXHAUSTEDbody containing agoogle.rpc.RetryInfo(or any other untypedgoogle.rpc.*detail) failed to deserialize and the client fell back toError::HttpStatus.VertexApiError::retry_delay() -> Option<Duration>. It finds a detail whose@typeisgoogle.rpc.RetryInfoor ends with/google.rpc.RetryInfo, readsretryDelay(orretry_delay), and parses the protobuf duration ("37s","1.5s").src/error.rs: addedError::retry_delay(), which delegates forError::VertexErrorand returnsNonefor every other variant.Breaking changes
VertexApiError.detailschanged type.ErrorType,ErrorInfoMetadata,FieldViolationandLink.Tests
Ported the unit tests from andreban/geologia@69e4108: whole and fractional delays, multiple details entries, malformed or missing delays, short and snake_case forms, and
Errordelegation. Added a deserialization test with an unknown detail type, plus a doctest.cargo testandcargo clippy --all-targetspass.f7cc9977aatocecc14d31e