| 1 | import { RpcError } from "../rpc.js"; |
| 2 | |
| 3 | // Codes the Go BrowserExecutor maps onto its kernel sentinels; anything else |
| 4 | // is a transport failure and therefore an unknown outcome for a reserved write. |
| 5 | export const BROWSER_ERR_STALE_REFERENCE = -32010; |
| 6 | export const BROWSER_ERR_TAKEN_OVER = -32011; |
| 7 | export const BROWSER_ERR_NO_GRANT = -32012; |
| 8 | |
| 9 | export function staleReference(detail: string): RpcError { |
| 10 | return new RpcError(BROWSER_ERR_STALE_REFERENCE, `stale reference: ${detail}`); |
| 11 | } |
| 12 | |
| 13 | export function takenOver(detail: string): RpcError { |
| 14 | return new RpcError(BROWSER_ERR_TAKEN_OVER, `tab taken over by the user: ${detail}`); |
| 15 | } |
| 16 | |
| 17 | export function noGrant(detail: string): RpcError { |
| 18 | return new RpcError(BROWSER_ERR_NO_GRANT, `no browser grant: ${detail}`); |
| 19 | } |
| 20 |