Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

986 B
Raw Blame
/** Keep cancellation distinct through relay/main/renderer: readdir wraps budget failures as install-rg guidance, and Quick Open displays load errors verbatim. */
export class FileListingCancelledError extends Error {
  constructor(message = 'File listing cancelled') {
    super(message)
    this.name = 'FileListingCancelledError'
  }
}

/** Preserve FileListingCancelledError reasons such as superseded; bare abort’s DOMException must not escape the cancellation classifier. */
export function fileListingCancellationError(signal?: AbortSignal): Error {
  const reason = signal?.reason
  if (reason instanceof FileListingCancelledError) {
    return reason
  }
  return new FileListingCancelledError()
}

export function throwIfFileListingCancelled(signal?: AbortSignal): void {
  if (signal?.aborted) {
    throw fileListingCancellationError(signal)
  }
}

export function isFileListingCancellation(error: unknown): boolean {
  return error instanceof FileListingCancelledError
}