fix(fsBridge): prevent unhandled rejection in downloadRemoteBuffer#1825
Merged
fix(fsBridge): prevent unhandled rejection in downloadRemoteBuffer#1825
Conversation
…ed rejections Fixes ELECTRON-77. The downloadRemoteBuffer function used Promise.reject() for URL validation errors, which could surface as unhandled promise rejections when the IPC bridge handler was invoked through an event emitter that does not await the returned promise. Using throw instead ensures the error is caught synchronously by the caller's try-catch.
Contributor
Code Review:fix(fsBridge): prevent unhandled rejection in downloadRemoteBuffer (#1825)变更概述本 PR 修复 Sentry 问题 ELECTRON-77(96 次出现),将 方案评估结论:✅ 方案合理
问题清单未发现任何新引入问题。lint 输出中出现的 汇总无问题。 结论✅ 批准合并 — 改动正确、简洁,测试覆盖充分,无阻塞性问题。 本报告由本地 CONCLUSION: APPROVED |
Contributor
|
✅ 已自动 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.
Summary
Closes #1824 — Fixes Sentry ELECTRON-77 (96 occurrences).
Promise.reject()withthrowindownloadRemoteBufferfor URL validation errors (unsupported protocol, disallowed host)Changes
src/process/bridge/fsBridge.ts: Changed 2return Promise.reject(new Error(...))→throw new Error(...)tests/unit/process/bridge/fsBridge.downloadRemoteBuffer.test.ts: Added tests verifying disallowed host, unsupported protocol, and invalid URL all return empty string gracefullyTest plan