diff options
Diffstat (limited to 'src/cdp/errors.ts')
| -rw-r--r-- | src/cdp/errors.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cdp/errors.ts b/src/cdp/errors.ts new file mode 100644 index 0000000..cf1dab7 --- /dev/null +++ b/src/cdp/errors.ts @@ -0,0 +1,19 @@ +export type CdpErrorKind = + | "transport_closed" + | "timeout" + | "session_not_found" + | "remote_error" + | "discovery_failed" + | "invalid_response"; + +export type CdpError = { + readonly kind: CdpErrorKind; + readonly message: string; + readonly method?: string; +}; + +export const cdpError = ( + kind: CdpErrorKind, + message: string, + method?: string, +): CdpError => ({ kind, message, ...(method !== undefined ? { method } : {}) }); |
