fix(web): manage plugin connections on mobile#1344
Conversation
| try { | ||
| await authClient.apiKey.delete({ keyId }) | ||
| const result = await authClient.apiKey.delete({ keyId }) | ||
| if (result.error) throw new Error(result.error.message) |
There was a problem hiding this comment.
The exception handling rule requires always using new Error() when throwing errors. On this line, throw new Error(result.error.message) is used correctly in terms of using new Error(), but the supporting data (the original result.error object) should be passed as the cause argument instead of inlining its message into the string. Fix: throw new Error(result.error.message, { cause: result.error }).
| if (result.error) throw new Error(result.error.message) | |
| if (result.error) throw new Error(result.error.message, { cause: result.error }) |
Spotted by Graphite (based on custom rule: TypeScript style guide (Google))
Is this helpful? React 👍 or 👎 to let us know.
| if (result.error) | ||
| throw new Error(result.error.message, { cause: result.error }) | ||
| const refreshed = await refetchKeys() | ||
| if (refreshed.error) throw refreshed.error |
There was a problem hiding this comment.
The Exception Handling rule requires always using new Error() when throwing errors. On this line, throw refreshed.error throws a raw error value directly without wrapping it in new Error(). This should be changed to something like throw new Error(refreshed.error.message, { cause: refreshed.error }) to comply with the rule.
| if (refreshed.error) throw refreshed.error | |
| if (refreshed.error) throw new Error(refreshed.error.message, { cause: refreshed.error }) |
Spotted by Graphite (based on custom rule: TypeScript style guide (Google))
Is this helpful? React 👍 or 👎 to let us know.
Restores Manage on active plugin cards on mobile. Disconnect now waits for deletion and refresh before showing success.
Biome and the web build pass.