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

Method WithProvider

coderd/x/chatd/chaterror/classify.go:86–98  ·  view source on GitHub ↗

WithProvider returns a copy of the classification using an explicit provider hint. Explicit provider hints are trusted over provider names heuristically parsed from the error text.

(provider string)

Source from the content-addressed store, hash-verified

84// provider hint. Explicit provider hints are trusted over provider names
85// heuristically parsed from the error text.
86func (c ClassifiedError) WithProvider(provider string) ClassifiedError {
87 hint := normalizeProvider(provider)
88 if hint == "" {
89 return normalizeClassification(c)
90 }
91 if c.Provider == hint && strings.TrimSpace(c.Message) != "" {
92 return normalizeClassification(c)
93 }
94 updated := c
95 updated.Provider = hint
96 updated.Message = ""
97 return normalizeClassification(updated)
98}
99
100// WithClassification wraps err so future calls to Classify return
101// classified instead of re-deriving it from err.Error().

Callers 5

runChatMethod · 0.45
RunFunction · 0.45

Calls 2

normalizeClassificationFunction · 0.85
normalizeProviderFunction · 0.70