fix (provider/gateway): image/video error handler#12506
Merged
mclenhard merged 7 commits intovercel:mainfrom Feb 13, 2026
Merged
fix (provider/gateway): image/video error handler#12506mclenhard merged 7 commits intovercel:mainfrom
mclenhard merged 7 commits intovercel:mainfrom
Conversation
shaper
approved these changes
Feb 12, 2026
gr2m
pushed a commit
that referenced
this pull request
Feb 16, 2026
# Add Gateway Timeout Error Handling Examples ## Background Proper error handling for timeout scenarios is crucial for applications using the AI Gateway. This PR improves the error handling for timeout situations and adds examples demonstrating how these errors are handled. ## Summary - Fixed error handling in Gateway models by making `asGatewayError` async in both image and video model implementations - Added three new examples demonstrating timeout error handling for: - Image generation (`generate-image/gateway-timeout.ts`) - Video generation (`generate-video/gateway-timeout.ts`) - Text streaming (`stream-text/gateway-timeout.ts`) Each example uses undici with an extremely short timeout (1ms) to deliberately trigger timeout errors, showing how the Gateway SDK catches and provides helpful error messages with troubleshooting guidance. ## Manual Verification Tested each example by running them with the AI Gateway API key set. Confirmed that they properly trigger timeout errors and display the expected error information including the original error cause. ## Checklist - [ ] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [ ] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [ ] I have reviewed this pull request (self-review)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Gateway Timeout Error Handling Examples
Background
Proper error handling for timeout scenarios is crucial for applications using the AI Gateway. This PR improves the error handling for timeout situations and adds examples demonstrating how these errors are handled.
Summary
asGatewayErrorasync in both image and video model implementationsgenerate-image/gateway-timeout.ts)generate-video/gateway-timeout.ts)stream-text/gateway-timeout.ts)Each example uses undici with an extremely short timeout (1ms) to deliberately trigger timeout errors, showing how the Gateway SDK catches and provides helpful error messages with troubleshooting guidance.
Manual Verification
Tested each example by running them with the AI Gateway API key set. Confirmed that they properly trigger timeout errors and display the expected error information including the original error cause.
Checklist
pnpm changesetin the project root)