MCPcopy
hub / github.com/opencloud-eu/opencloud / Render

Method Render

services/graph/pkg/errorcode/errorcode.go:132–157  ·  view source on GitHub ↗

Render writes a Graph Error object to the response writer

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

130
131// Render writes a Graph Error object to the response writer
132func (e Error) Render(w http.ResponseWriter, r *http.Request) {
133 var status int
134 switch e.errorCode {
135 case AccessDenied:
136 status = http.StatusForbidden
137 case NotSupported:
138 status = http.StatusNotImplemented
139 case InvalidRange:
140 status = http.StatusRequestedRangeNotSatisfiable
141 case InvalidRequest:
142 status = http.StatusBadRequest
143 case ItemNotFound:
144 status = http.StatusNotFound
145 case NameAlreadyExists:
146 status = http.StatusConflict
147 case NotAllowed:
148 status = http.StatusMethodNotAllowed
149 case ItemIsLocked:
150 status = http.StatusLocked
151 case PreconditionFailed:
152 status = http.StatusPreconditionFailed
153 default:
154 status = http.StatusInternalServerError
155 }
156 e.errorCode.Render(w, r, status, e.msg)
157}
158
159// String returns the string corresponding to the ErrorCode
160func (e ErrorCode) String() string {

Callers 15

GetUsersMethod · 0.95
benchmarkFunction · 0.45
VersionCommandFunction · 0.45
ListMethod · 0.45
VersionFunction · 0.45
VersionFunction · 0.45
VersionFunction · 0.45
VersionFunction · 0.45
VersionFunction · 0.45
VersionFunction · 0.45
VersionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected