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

Function correctCancelError

coderd/rbac/error.go:121–127  ·  view source on GitHub ↗

correctCancelError will return the correct error for a canceled context. This is because rego changes a canceled context to a topdown.CancelErr. This error is not helpful if the code is "canceled". To make the error conform with the rest of our canceled errors, we will convert the error to a context

(err error)

Source from the content-addressed store, hash-verified

119// error. No good information is lost, as the topdown.CancelErr provides the
120// location of the query that was canceled, which does not matter.
121func correctCancelError(err error) error {
122 e := new(topdown.Error)
123 if xerrors.As(err, &e) || e.Code == topdown.CancelErr {
124 return context.Canceled
125 }
126 return err
127}

Callers 3

authorizeMethod · 0.85
PrepareMethod · 0.85
AuthorizeMethod · 0.85

Calls 1

AsMethod · 0.80

Tested by

no test coverage detected