feat: Add error details in onFailed delegate callback#132
feat: Add error details in onFailed delegate callback#132Balamurugan-Testpress merged 6 commits intomainfrom
Conversation
Balamurugan-Testpress
commented
Mar 4, 2026
- Update TPStreamsDownloadDelegate.onFailed to include an Error parameter
- Propagate system and network errors to the delegate for better debugging
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the error reporting in the TPStreams SDK by including an Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully updates the onFailed delegate callback to include an Error parameter, which significantly improves error reporting and debugging capabilities within the download manager. The changes are well-integrated across the delegate protocol definition, its default implementation, and various call sites where download failures are handled.
|
|
||
| LocalOfflineAsset.manager.update(object: localOfflineAsset, with: ["status": Status.failed.rawValue]) | ||
| tpStreamsDownloadDelegate?.onFailed(offlineAsset: localOfflineAsset.asOfflineAsset()) | ||
| let downloadError = error ?? TPDownloadError.downloadExecutionFailed(NSError(domain: "TPStreamsSDK", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unknown error"])) |
There was a problem hiding this comment.
The NSError created here uses a generic code -1 and a description "Unknown error". While functional, it would be beneficial for debugging if the error code was more specific to the context of the failure, or if a more descriptive TPDownloadError case was used directly for truly unknown errors. Consider defining a more specific TPDownloadError case or a more granular NSError code for better error differentiation.
| let downloadError = error ?? TPDownloadError.downloadExecutionFailed(NSError(domain: "TPStreamsSDK", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unknown error"])) | |
| let downloadError = error ?? TPDownloadError.downloadExecutionFailed(NSError(domain: "TPStreamsSDK", code: TPDownloadError.unknownExecutionErrorCode, userInfo: [NSLocalizedDescriptionKey: "An unexpected download execution error occurred."])) |
| tpStreamsDownloadDelegate?.onCanceled(assetId: localOfflineAsset.assetId) | ||
| } else if status == Status.failed { | ||
| tpStreamsDownloadDelegate?.onFailed(offlineAsset: localOfflineAsset.asOfflineAsset()) | ||
| let downloadError = error ?? TPDownloadError.downloadExecutionFailed(NSError(domain: "TPStreamsSDK", code: -1, userInfo: [NSLocalizedDescriptionKey: "Download failed"])) |
There was a problem hiding this comment.
Similar to the previous comment, this NSError uses a generic code -1 and a description "Download failed". For consistency and improved debuggability, it's recommended to use a more specific error code or a more detailed description. Also, ensure consistency in the default error messages across different failure points (e.g., "Unknown error" vs. "Download failed").
| let downloadError = error ?? TPDownloadError.downloadExecutionFailed(NSError(domain: "TPStreamsSDK", code: -1, userInfo: [NSLocalizedDescriptionKey: "Download failed"])) | |
| let downloadError = error ?? TPDownloadError.downloadExecutionFailed(NSError(domain: "TPStreamsSDK", code: TPDownloadError.downloadFailedErrorCode, userInfo: [NSLocalizedDescriptionKey: "Download failed unexpectedly."])) |
ca336c4 to
f9c86ef
Compare
- Enable optional fallback when the requested resolution is unavailable - Select the closest available resolution when fallback is enabled - Prefer the lower resolution if multiple options are equally close
- Update TPStreamsDownloadDelegate.onFailed to include an Error parameter - Propagate system and network errors to the delegate for better debugging - Map internal SDK failures to TPDownloadError for consistent error reporting
f9c86ef to
d5f1132
Compare