MCPcopy Index your code
hub / github.com/simstudioai/sim / extractDaytonaError

Function extractDaytonaError

apps/sim/tools/daytona/utils.ts:43–53  ·  view source on GitHub ↗
(response: Response, fallback: string)

Source from the content-addressed store, hash-verified

41 * Extracts a human-readable error message from a Daytona API error response.
42 */
43export async function extractDaytonaError(response: Response, fallback: string): Promise<string> {
44 try {
45 const data = await response.json()
46 if (typeof data?.message === 'string') return data.message
47 if (Array.isArray(data?.message)) return data.message.join(', ')
48 if (typeof data?.error === 'string') return data.error
49 } catch {
50 // Non-JSON error body; fall through to the fallback message
51 }
52 return `${fallback} (status ${response.status})`
53}
54
55/**
56 * Coerces an optional user- or LLM-provided value to a number, treating

Callers 12

stop_sandbox.tsFile · 0.90
git_clone.tsFile · 0.90
list_files.tsFile · 0.90
get_sandbox.tsFile · 0.90
download_file.tsFile · 0.90
execute_command.tsFile · 0.90
delete_sandbox.tsFile · 0.90
list_sandboxes.tsFile · 0.90
create_sandbox.tsFile · 0.90
start_sandbox.tsFile · 0.90
run_code.tsFile · 0.90
route.tsFile · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected