Commit 0f82ecd
octo-patch
fix(commands): also catch synchronous throws in command action
`Browser.commands.onCommand`'s `tab` parameter is documented as optional, so
an action that dereferences `tab.*` (e.g. `openSidePanel` reading
`tab.windowId` / `tab.id`) can throw synchronously before returning a
Promise. The previous `.catch` only observed Promise rejections, so a
synchronous throw would still surface as an uncaught error in the background
script.
Wrap the action invocation in try/catch and log+return on synchronous
failure, mirroring the async rejection handling.
Addresses CodeRabbit review on PR #963.1 parent 810e8d3 commit 0f82ecd
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
| |||
0 commit comments