MCPcopy
hub / github.com/NVIDIA/aistore / azureErrorToAISError

Function azureErrorToAISError

ais/backend/azure.go:153–175  ·  view source on GitHub ↗
(azureError error, bck *cmn.Bck, objName string)

Source from the content-addressed store, hash-verified

151}
152
153func azureErrorToAISError(azureError error, bck *cmn.Bck, objName string) (int, error) {
154 stgErr, ok := azureError.(azblob.StorageError)
155 if !ok {
156 return http.StatusInternalServerError, azureError
157 }
158 switch stgErr.ServiceCode() {
159 case azblob.ServiceCodeContainerNotFound:
160 return http.StatusNotFound, cmn.NewErrRemoteBckNotFound(bck)
161 case azblob.ServiceCodeBlobNotFound:
162 msg := fmt.Sprintf("%s/%s not found", bck, objName)
163 return http.StatusNotFound, cmn.NewErrHTTP(nil, msg, http.StatusNotFound)
164 case azblob.ServiceCodeInvalidResourceName:
165 msg := fmt.Sprintf("%s/%s not found", bck, objName)
166 return http.StatusNotFound, cmn.NewErrHTTP(nil, msg, http.StatusNotFound)
167 default:
168 resp := stgErr.Response()
169 if resp != nil {
170 resp.Body.Close()
171 return resp.StatusCode, azureError
172 }
173 return http.StatusInternalServerError, azureError
174 }
175}
176
177func (*azureProvider) Provider() string { return apc.ProviderAzure }
178

Callers 7

HeadBucketMethod · 0.85
ListObjectsMethod · 0.85
ListBucketsMethod · 0.85
HeadObjMethod · 0.85
GetObjReaderMethod · 0.85
PutObjMethod · 0.85
DeleteObjMethod · 0.85

Calls 3

NewErrRemoteBckNotFoundFunction · 0.92
NewErrHTTPFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected