Files
plan-tools/node_modules/bare-fs/lib/errors.js
Taylor Eernisse e7882b917b Add Brave CDP automation, replace Oracle browser mode
Connects to user's running Brave via Chrome DevTools Protocol
to automate ChatGPT interaction. Uses puppeteer-core to open a
tab, send the prompt, wait for response, and extract the result.

No cookies, no separate profiles, no copy/paste. Just connects
to the browser where the user is already logged in.

One-time setup: relaunch Brave with --remote-debugging-port=9222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:16:41 -05:00

56 lines
1.1 KiB
JavaScript

const os = require('bare-os')
module.exports = class FileError extends Error {
constructor(msg, opts = {}) {
const { code, operation = null, path = null, destination = null, fd = -1 } = opts
if (operation !== null) msg += describe(operation, opts)
super(`${code}: ${msg}`)
this.code = code
if (operation !== null) this.operation = operation
if (path !== null) this.path = path
if (destination !== null) this.destination = destination
if (fd !== -1) this.fd = fd
}
get name() {
return 'FileError'
}
// For Node.js compatibility
get errno() {
return os.constants.errnos[this.code]
}
// For Node.js compatibility
get syscall() {
return this.operation
}
// For Node.js compatibility
get dest() {
return this.destination
}
}
function describe(operation, opts) {
const { path = null, destination = null, fd = -1 } = opts
let result = `, ${operation}`
if (path !== null) {
result += ` ${JSON.stringify(path)}`
if (destination !== null) {
result += ` -> ${JSON.stringify(destination)}`
}
} else if (fd !== -1) {
result += ` ${fd}`
}
return result
}