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.

888 B
Raw Blame
import { RuntimeClientError, RuntimeRpcFailureError } from './types'

export function attachMutationRecovery(
  error: unknown,
  requestId: string | undefined,
  originalCommand?: string[]
): unknown {
  if (!requestId || !(error instanceof RuntimeClientError)) {
    return error
  }
  const data = {
    ...(error.data && typeof error.data === 'object' ? error.data : {}),
    orchestrationRequestId: requestId,
    ...(originalCommand ? { originalCommand } : {})
  }
  if (error instanceof RuntimeRpcFailureError) {
    return new RuntimeRpcFailureError({
      ...error.response,
      error: {
        ...error.response.error,
        message: `${error.message} Orchestration mutation request ID: ${requestId}.`,
        data
      }
    })
  }
  return new RuntimeClientError(
    error.code,
    `${error.message} Orchestration mutation request ID: ${requestId}.`,
    data
  )
}