(azureError error, bck *cmn.Bck, objName string)
| 151 | } |
| 152 | |
| 153 | func 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 | |
| 177 | func (*azureProvider) Provider() string { return apc.ProviderAzure } |
| 178 |
no test coverage detected