MCPcopy Index your code
hub / github.com/coder/coder / chatDebugAttempts

Function chatDebugAttempts

coderd/database/db2sdk/db2sdk.go:1829–1849  ·  view source on GitHub ↗
(raw json.RawMessage)

Source from the content-addressed store, hash-verified

1827}
1828
1829func chatDebugAttempts(raw json.RawMessage) []map[string]any {
1830 if len(raw) == 0 {
1831 return nil
1832 }
1833
1834 var attempts []map[string]any
1835 if err := json.Unmarshal(raw, &attempts); err != nil {
1836 return []map[string]any{{
1837 "error": "malformed attempts payload",
1838 "parse_error": err.Error(),
1839 "raw": string(raw),
1840 }}
1841 }
1842 // Guard against JSON literal "null" which unmarshals successfully
1843 // but leaves the slice nil. The DB column is JSONB NOT NULL but
1844 // that only rejects SQL NULL, not JSONB null.
1845 if attempts == nil {
1846 return []map[string]any{}
1847 }
1848 return attempts
1849}
1850
1851// rawJSONObject deserializes a JSON object payload for debug display.
1852// If the payload is malformed, it returns a map with "error" and "raw"

Callers 1

ChatDebugStepFunction · 0.85

Calls 2

UnmarshalMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected