fix(chromium-tabs): say why a tab cannot be opened in an Electron app - #659
Open
filip131311 wants to merge 2 commits into
Open
fix(chromium-tabs): say why a tab cannot be opened in an Electron app#659filip131311 wants to merge 2 commits into
filip131311 wants to merge 2 commits into
Conversation
`chromium-tabs action=new` failed with a bare "Not supported" — Electron's own answer to `Target.createTarget`, passed through untouched. It names neither the cause nor a way forward, and reads as though the tool were unavailable, when in fact only this one action is: list, select and close all work, and the app can open a window itself, which then shows up in the list. The failure is now wrapped with that explanation. The underlying error is kept in the message rather than matched on, so a different cause — a dropped connection, a real Chrome refusing the url — stays legible instead of being relabelled as an Electron limitation. Fixes #634
The new case constructed it positionally, which vitest ran happily but the test typecheck rejected.
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.
Fixes #634.
The old text is Electron's own CDP answer to
Target.createTarget, passed through untouched. Thelimitation is real, but the message names neither the cause nor a way forward, and reads as though the
tool were unavailable — when only this one action is.
Two things I checked before writing the message
window.open('about:blank')viadebugger-evaluateand the new window appeared inchromium-tabs listast2. I didn't want toship advice I hadn't run.
listreturns correctly both before and after.Why the cause is kept rather than matched on
Target.createTargetcan fail for reasons other than Electron's missing browser shell — a droppedconnection, or a real Chrome refusing the url. The CDP client keeps only the error's
messageanddiscards its numeric code, so branching would mean matching on the string
"Not supported", whichbreaks the moment Electron rephrases it.
Instead any failure is wrapped, with the original message embedded. The explanation is worded as a
property of Electron rather than a claim about this failure, so it stays accurate when the cause is
something else — and the underlying error is still right there to read.
Verification
Live against the Electron testbed (Electron 42 / Chrome 148): the message above is the real output,
and
liststill works alongside it. tool-server 3087 passed, plus a new test asserting the messagekeeps the original cause and carries the reason, the workaround, and the note that the other actions
are unaffected.
🤖 Generated with Claude Code