MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / writeCustomErrorResponseJSON

Function writeCustomErrorResponseJSON

cmd/api-response.go:906–921  ·  view source on GitHub ↗

writeCustomErrorResponseJSON - similar to writeErrorResponseJSON, but accepts the error message directly (this allows messages to be dynamically generated.)

(ctx context.Context, w http.ResponseWriter, err APIError,
	errBody string, reqURL *url.URL,
)

Source from the content-addressed store, hash-verified

904// but accepts the error message directly (this allows messages to be
905// dynamically generated.)
906func writeCustomErrorResponseJSON(ctx context.Context, w http.ResponseWriter, err APIError,
907 errBody string, reqURL *url.URL,
908) {
909 reqInfo := logger.GetReqInfo(ctx)
910 errorResponse := APIErrorResponse{
911 Code: err.Code,
912 Message: errBody,
913 Resource: reqURL.Path,
914 BucketName: reqInfo.BucketName,
915 Key: reqInfo.ObjectName,
916 RequestID: w.Header().Get(xhttp.AmzRequestID),
917 HostID: globalDeploymentID,
918 }
919 encodedErrorResponse := encodeResponseJSON(errorResponse)
920 writeResponse(w, err.HTTPStatusCode, encodedErrorResponse, mimeJSON)
921}

Callers 15

KMSStatusHandlerMethod · 0.85
KMSMetricsHandlerMethod · 0.85
KMSAPIsHandlerMethod · 0.85
KMSVersionHandlerMethod · 0.85
KMSListKeysHandlerMethod · 0.85
KMSKeyStatusHandlerMethod · 0.85
KMSGetPolicyHandlerMethod · 0.85

Calls 5

GetReqInfoFunction · 0.92
encodeResponseJSONFunction · 0.85
writeResponseFunction · 0.85
GetMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected