azurestore: Work around error being not comparable

This commit is contained in:
Marius 2022-03-19 23:41:54 +01:00
parent e77cc64063
commit 7eae867ec1
2 changed files with 8 additions and 2 deletions

View File

@ -112,9 +112,13 @@ func (store AzureStore) GetUpload(ctx context.Context, id string) (handler.Uploa
}
offset, err := blockBlob.GetOffset(ctx)
if err != nil && err != handler.ErrNotFound {
if err != nil {
// Unpack the error and see if it is a handler.ErrNotFound by comparing the
// error code. If it matches, we ignore the error, otherwise we return the error.
if handlerErr, ok := err.(handler.Error); !ok || handlerErr.ErrorCode != handler.ErrNotFound.ErrorCode {
return nil, err
}
}
info.Offset = offset

View File

@ -3,6 +3,8 @@ package handler
// Error represents an error with the intent to be sent in the HTTP
// response to the client. Therefore, it also contains a HTTPResponse,
// next to an error code and error message.
// TODO: Error is not comparable anymore because HTTPResponse
// contains a map. See if we should change this.
type Error struct {
ErrorCode string
Message string