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

Function newResponseError

codersdk/chats.go:1886–1911  ·  view source on GitHub ↗
(res *http.Response, response Response)

Source from the content-addressed store, hash-verified

1884}
1885
1886func newResponseError(res *http.Response, response Response) *Error {
1887 if res == nil {
1888 return &Error{Response: response}
1889 }
1890
1891 var requestMethod, requestURL string
1892 if res.Request != nil {
1893 requestMethod = res.Request.Method
1894 if res.Request.URL != nil {
1895 requestURL = res.Request.URL.String()
1896 }
1897 }
1898
1899 var helpMessage string
1900 if res.StatusCode == http.StatusUnauthorized {
1901 helpMessage = "Try logging in using 'coder login'."
1902 }
1903
1904 return &Error{
1905 Response: response,
1906 statusCode: res.StatusCode,
1907 method: requestMethod,
1908 url: requestURL,
1909 Helper: helpMessage,
1910 }
1911}
1912
1913// ChatUsageLimitExceededFrom extracts a structured chat usage limit response
1914// from an SDK error returned by chat mutation methods.

Callers 2

readRawBodyAsErrorFunction · 0.70

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected