fix(channel): surface backend failures when toggling a plugin#3295
Open
szafranski wants to merge 1 commit into
Open
fix(channel): surface backend failures when toggling a plugin#3295szafranski wants to merge 1 commit into
szafranski wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
73d86ee to
dd816bd
Compare
The channel enable/disable endpoints return HTTP 200 with
`{ success: false, error }` on failure, but `httpRequest` only throws on
non-2xx responses and `enablePlugin`/`disablePlugin` discarded the body.
A failed enable therefore showed a success toast while the toggle
reverted and the plugin stayed disabled — exactly the misleading
feedback reported when re-enabling a channel.
Add `expectBridgeSuccess`, which throws when a `BridgeResponse` reports
`success: false`, and apply it to channel enable/disable so the existing
try/catch handlers surface the real error instead of a success message.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dd816bd to
f8c99f5
Compare
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.
Pull Request
Description
The channel enable/disable endpoints return HTTP 200 with
{ success: false, error }on failure, buthttpRequestonly throws on non-2xx responses andenablePlugin/disablePlugindiscarded the response body. A failed enable therefore showed a success toast while the toggle reverted and the plugin stayed disabled — exactly the misleading feedback reported when re-enabling a channel.Adds
expectBridgeSuccess, which throws when aBridgeResponsereportssuccess: false, and applies it to channel enable/disable so the existingtry/catchhandlers surface the real error instead of a success message.Related Issues
Type of Change
Testing
Added 3 unit tests in
httpBridge.test.tscovering success (resolves), failure (throws the backend error on HTTP 200 +success: false), and the generic-message fallback.bunx vitest run→ 1202 passedbunx tsc --noEmit→ cleanbun run lint→ 0 errorsbun run format→ appliedAdditional Context
httpRequestunwraps the{ data }envelope, soenablePlugin/disablePluginalready received the innerBridgeResponse; they just ignored it. The wrapper centralizes thesuccesscheck so all existing callers (channel toggles, auto-enable) benefit without changes.Thank you for contributing to AionUi! 🎉