MCPcopy Create free account
hub / github.com/cyberagiinc/DevDocs / fetchDebugOutput

Function fetchDebugOutput

components/DebugOutput.tsx:40–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38 }
39
40 const fetchDebugOutput = async () => {
41 setIsLoading(true)
42 setError(null)
43
44 try {
45 const response = await fetch('/api/debug')
46
47 if (!response.ok) {
48 const errorData = await response.json()
49 throw new Error(errorData.error || 'Failed to fetch debug output')
50 }
51
52 const data = await response.json()
53
54 if (!data.success) {
55 throw new Error(data.error || 'Failed to execute debug script')
56 }
57
58 setOutput(data.output || 'No output returned')
59 if (data.error) {
60 setError(data.error)
61 }
62 setLastUpdated(new Date())
63 } catch (error) {
64 console.error('Error fetching debug output:', error)
65 setError(error instanceof Error ? error.message : 'Failed to fetch debug output')
66 setOutput('')
67
68 // If we failed to execute the script, try to fetch the script content
69 if (!scriptContent) {
70 fetchScriptContent()
71 }
72 } finally {
73 setIsLoading(false)
74 }
75 }
76
77 // Toggle between script view and output view
78 const toggleScriptView = () => {

Callers 1

DebugOutputFunction · 0.85

Calls 1

fetchScriptContentFunction · 0.85

Tested by

no test coverage detected