MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / AsAPIError

Function AsAPIError

internal/cli/client.go:3226–3232  ·  view source on GitHub ↗

AsAPIError returns the *APIError in err's chain, or nil. Use it instead of a direct err.(*APIError) assertion: a write that sent an op_key comes back wrapped in *OpKeyError (BUG-3999), which a direct assertion does not see through.

(err error)

Source from the content-addressed store, hash-verified

3224// wrapped in *OpKeyError (BUG-3999), which a direct assertion does not see
3225// through.
3226func AsAPIError(err error) *APIError {
3227 var apiErr *APIError
3228 if errors.As(err, &apiErr) {
3229 return apiErr
3230 }
3231 return nil
3232}
3233
3234// OpKeyError carries the idempotency key a failed write sent (BUG-3999), so
3235// the root error writer can print it and a person or agent can re-run the

Callers 14

resetPasswordCmdFunction · 0.92
inviteCmdFunction · 0.92
workspaceCreateCmdFunction · 0.92
libraryGetCmdFunction · 0.92
libraryActivateCmdFunction · 0.92
readBuiltinStateFunction · 0.92
libraryUpdateCmdFunction · 0.92
webhooksCreateCmdFunction · 0.92
tokenCreateCmdFunction · 0.92
createCmdFunction · 0.92
updateCmdFunction · 0.92
moveCmdFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected