upload/azure: remove an unneeded custom error type
The errorString was not exported and used anywhere else, this commit replaces it with a standard method of creating simple errors.
This commit is contained in:
parent
e52a35d84e
commit
5415be465f
1 changed files with 2 additions and 9 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
|
|
@ -14,14 +15,6 @@ import (
|
|||
"github.com/Azure/azure-storage-blob-go/azblob"
|
||||
)
|
||||
|
||||
type errorString struct {
|
||||
s string
|
||||
}
|
||||
|
||||
func (e *errorString) Error() string {
|
||||
return e.s
|
||||
}
|
||||
|
||||
// Credentials contains credentials to connect to your account
|
||||
// It uses so called "Client credentials", see the official documentation for more information:
|
||||
// https://docs.microsoft.com/en-us/azure/go/azure-sdk-go-authorization#available-authentication-types-and-methods
|
||||
|
|
@ -153,7 +146,7 @@ func UploadImage(credentials Credentials, metadata ImageMetadata, fileName strin
|
|||
var fileChecksum []byte = imageFileHash.Sum(nil)
|
||||
|
||||
if !bytes.Equal(blobChecksum, fileChecksum) {
|
||||
return &errorString{"error during image upload. the image seems to be corrupted"}
|
||||
return errors.New("error during image upload. the image seems to be corrupted")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue