Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/chunk-8gyk2127.js → dist/chunk-73r9sqrg.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { isatty } from "node:tty";
var DEFAULT_PROTECTED_INPUT_MAXIMUM_BYTES = 65536;

class ProtectedInputError extends Error {
code;
name = "ProtectedInputError";
code;
constructor(code, message) {
super(message);
this.code = code;
Expand Down
2 changes: 1 addition & 1 deletion dist/chunk-k2mgjyx4.js → dist/chunk-e5csbmsf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { chmod, unlink } from "node:fs/promises";
import { createServer, connect } from "node:net";
import { dirname } from "node:path";
class ControlSocketError extends Error {
code;
name = "ControlSocketError";
code;
constructor(code, message, options) {
super(message, options);
this.code = code;
Expand Down
2 changes: 1 addition & 1 deletion dist/control-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
attachControlSocket,
listenControlSocket,
requestControlSocket
} from "./chunk-k2mgjyx4.js";
} from "./chunk-e5csbmsf.js";
import"./chunk-xrgz1k0h.js";
export {
requestControlSocket,
Expand Down
12 changes: 6 additions & 6 deletions dist/custody-rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
attachControlSocket,
listenControlSocket,
requestControlSocket
} from "./chunk-k2mgjyx4.js";
} from "./chunk-e5csbmsf.js";
import {
assertOwnedPath,
ensurePrivateDirectory,
Expand All @@ -16,7 +16,7 @@ import {
DEFAULT_PROTECTED_INPUT_MAXIMUM_BYTES,
readProtectedDescriptor,
readProtectedStdin
} from "./chunk-8gyk2127.js";
} from "./chunk-73r9sqrg.js";
import {
emitLocalCustodyFallback
} from "./chunk-np3mgd4s.js";
Expand All @@ -36,10 +36,10 @@ var MAXIMUM_CONTROL_TIMEOUT_MS = 3600000;
var publishNamePattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,126}$/u;

class CustodySidecarNotFoundError extends Error {
name;
platform;
arch;
binaryPath;
name;
constructor(platform, arch, binaryPath) {
super(`local-custody sidecar not found for ${platform}-${arch} at ${binaryPath}`);
this.platform = platform;
Expand All @@ -50,8 +50,8 @@ class CustodySidecarNotFoundError extends Error {
}

class CustodySidecarTimeoutError extends Error {
timeoutMs;
name;
timeoutMs;
constructor(timeoutMs) {
super(`local-custody sidecar did not respond within ${timeoutMs} ms`);
this.timeoutMs = timeoutMs;
Expand All @@ -60,9 +60,9 @@ class CustodySidecarTimeoutError extends Error {
}

class CustodySidecarProtocolError extends Error {
name;
reason;
stdout;
name;
constructor(reason, stdout) {
super(`local-custody sidecar produced unparseable output: ${String(reason)}`);
this.reason = reason;
Expand All @@ -72,9 +72,9 @@ class CustodySidecarProtocolError extends Error {
}

class CustodyError extends Error {
name;
code;
details;
name;
constructor(code, details) {
super(`local-custody sidecar op failed: ${code}`);
this.code = code;
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
attachControlSocket,
listenControlSocket,
requestControlSocket
} from "./chunk-k2mgjyx4.js";
} from "./chunk-e5csbmsf.js";
import {
PRIVATE_DIRECTORY_MODE,
PRIVATE_FILE_MODE,
Expand All @@ -26,7 +26,7 @@ import {
ProtectedInputError,
readProtectedDescriptor,
readProtectedStdin
} from "./chunk-8gyk2127.js";
} from "./chunk-73r9sqrg.js";
// src/describe.ts
var CUSTODY_ERROR_COPY = Object.freeze({
"service-not-running": Object.freeze({
Expand Down
2 changes: 1 addition & 1 deletion dist/protected-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ProtectedInputError,
readProtectedDescriptor,
readProtectedStdin
} from "./chunk-8gyk2127.js";
} from "./chunk-73r9sqrg.js";
export {
readProtectedStdin,
readProtectedDescriptor,
Expand Down
4 changes: 3 additions & 1 deletion src/control-socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export type ControlSocketErrorCode =
/** A control request failure with a stable `code`. Messages are unchanged from earlier releases. */
export class ControlSocketError extends Error {
override readonly name = "ControlSocketError";
constructor(readonly code: ControlSocketErrorCode, message: string, options?: Readonly<{ cause?: unknown }>) {
readonly code: ControlSocketErrorCode;
constructor(code: ControlSocketErrorCode, message: string, options?: Readonly<{ cause?: unknown }>) {
super(message, options);
this.code = code;
}
}

Expand Down
32 changes: 24 additions & 8 deletions src/custody-rust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,43 @@ const publishNamePattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,126}$/u;

export class CustodySidecarNotFoundError extends Error {
override readonly name: "CustodySidecarNotFoundError";
readonly platform: string;
readonly arch: string;
readonly binaryPath: string;
constructor(
readonly platform: string,
readonly arch: string,
readonly binaryPath: string,
platform: string,
arch: string,
binaryPath: string,
) {
super(`local-custody sidecar not found for ${platform}-${arch} at ${binaryPath}`);
this.platform = platform;
this.arch = arch;
this.binaryPath = binaryPath;
this.name = "CustodySidecarNotFoundError";
}
}

export class CustodySidecarTimeoutError extends Error {
override readonly name: "CustodySidecarTimeoutError";
constructor(readonly timeoutMs: number) {
readonly timeoutMs: number;
constructor(timeoutMs: number) {
super(`local-custody sidecar did not respond within ${timeoutMs} ms`);
this.timeoutMs = timeoutMs;
this.name = "CustodySidecarTimeoutError";
}
}

export class CustodySidecarProtocolError extends Error {
override readonly name: "CustodySidecarProtocolError";
readonly reason: unknown;
readonly stdout: string;
constructor(
readonly reason: unknown,
readonly stdout: string,
reason: unknown,
stdout: string,
) {
super(`local-custody sidecar produced unparseable output: ${String(reason)}`);
this.reason = reason;
this.stdout = stdout;
this.name = "CustodySidecarProtocolError";
}
}
Expand All @@ -85,11 +97,15 @@ export class CustodySidecarProtocolError extends Error {
*/
export class CustodyError extends Error {
override readonly name: "CustodyError";
readonly code: string;
readonly details: Readonly<Record<string, unknown>>;
constructor(
readonly code: string,
readonly details: Readonly<Record<string, unknown>>,
code: string,
details: Readonly<Record<string, unknown>>,
) {
super(`local-custody sidecar op failed: ${code}`);
this.code = code;
this.details = details;
this.name = "CustodyError";
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/protected-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export type ProtectedInputErrorCode = "protected-terminal" | "protected-unsafe-f
/** A protected-input refusal with a stable `code` for `describeCustodyError`. */
export class ProtectedInputError extends Error {
override readonly name = "ProtectedInputError";
constructor(readonly code: ProtectedInputErrorCode, message: string) {
readonly code: ProtectedInputErrorCode;
constructor(code: ProtectedInputErrorCode, message: string) {
super(message);
this.code = code;
}
}

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"useUnknownInCatchVariables": true,
"erasableSyntaxOnly": true,
"allowImportingTsExtensions": true,
"isolatedModules": true,
"skipLibCheck": true,
Expand Down
Loading