MCPcopy Create free account
hub / github.com/imroc/req / SetCommonErrorResult

Method SetCommonErrorResult

client.go:186–191  ·  view source on GitHub ↗

SetCommonErrorResult set the common result that response body will be unmarshalled to if no error occurs but Response.ResultState returns ErrorState, by default it is HTTP status `code >= 400`, you can also use SetCommonResultStateChecker to customize the result state check logic.

(err any)

Source from the content-addressed store, hash-verified

184// is HTTP status `code >= 400`, you can also use SetCommonResultStateChecker
185// to customize the result state check logic.
186func (c *Client) SetCommonErrorResult(err any) *Client {
187 if err != nil {
188 c.commonErrorType = util.GetType(err)
189 }
190 return c
191}
192
193// ResultState represents the state of the result.
194type ResultState int

Callers 6

SetCommonErrorMethod · 0.95
testErrorFunction · 0.80
SetCommonErrorFunction · 0.80
SetCommonErrorResultFunction · 0.80
NewClientFunction · 0.80
initFunction · 0.80

Calls 1

GetTypeFunction · 0.92

Tested by 1

testErrorFunction · 0.64