Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove underlyingError from GenerateContentError.invalidAPIKey #92

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

andrewheard
Copy link
Collaborator

Removed the underlyingError: Error associated value from the GenerateContentError.invalidAPIKey enum case. We could consider adding a specific value (similar to RPCError but public) in the future but for now the enum case itself (invalidAPIKey) captures the information that devs need to act on.

Same expected usage as before:

do {
  let content = try await model.generateContent("Why is the sky blue?")
} catch GenerateContentError.invalidAPIKey {
  // Devs can decide how they want to display this error to users
  print("The provided API key is invalid.")
} catch {
  // A different error occurred
}

@github-actions github-actions bot added component:swift sdk Issue/PR related to Swift SDK status:awaiting review PR awaiting review from a maintainer labels Jan 18, 2024
@andrewheard andrewheard requested a review from paulb777 January 18, 2024 20:15
@andrewheard andrewheard merged commit 31f762d into main Jan 25, 2024
8 checks passed
@andrewheard andrewheard deleted the ah/invalid-api-key branch January 25, 2024 17:44
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:swift sdk Issue/PR related to Swift SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants