MCPcopy Create free account
hub / github.com/gogs/gogs / NotFoundOrError

Method NotFoundOrError

internal/context/api.go:64–70  ·  view source on GitHub ↗

NotFoundOrError use error check function to determine if the error is about not found. It responses with 404 status code for not found error, or error context description for logging purpose of 500 server error.

(err error, msg string)

Source from the content-addressed store, hash-verified

62// is about not found. It responses with 404 status code for not found error,
63// or error context description for logging purpose of 500 server error.
64func (c *APIContext) NotFoundOrError(err error, msg string) {
65 if errutil.IsNotFound(err) {
66 c.NotFound()
67 return
68 }
69 c.Error(err, msg)
70}
71
72// SetLinkHeader sets pagination link header by given total number and page size.
73func (c *APIContext) SetLinkHeader(total, pageSize int) {

Callers 15

HandleOrgAssignmentFunction · 0.45
RepoAssignmentFunction · 0.45
InjectParamsUserFunction · 0.45
runWebFunction · 0.45
getDashboardContextUserFunction · 0.45
Email2UserFunction · 0.45
SettingsLeaveRepoFunction · 0.45
EditReleaseFunction · 0.45
EditReleasePostFunction · 0.45
parseBaseRepositoryFunction · 0.45
checkPullInfoFunction · 0.45
MergePullRequestFunction · 0.45

Calls 3

NotFoundMethod · 0.95
ErrorMethod · 0.95
IsNotFoundFunction · 0.92

Tested by

no test coverage detected