shared/filestore: Add detailed error context for S3.TestConnection (#29838)
We were just returning a string without embedding the actual error returned. This was making things difficult to debug. ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4a59d4c08e
Коммит
53d6f59ff5
@@ -7,6 +7,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -215,7 +216,7 @@ func (b *S3FileBackend) TestConnection() error {
|
|||||||
if obj.Err != nil {
|
if obj.Err != nil {
|
||||||
typedErr := s3.ToErrorResponse(obj.Err)
|
typedErr := s3.ToErrorResponse(obj.Err)
|
||||||
if typedErr.Code != bucketNotFound && typedErr.Code != invalidBucket {
|
if typedErr.Code != bucketNotFound && typedErr.Code != invalidBucket {
|
||||||
return &S3FileBackendAuthError{DetailedError: "unable to list objects in the S3 bucket"}
|
return &S3FileBackendAuthError{DetailedError: fmt.Sprintf("unable to list objects in the S3 bucket: %v", typedErr)}
|
||||||
}
|
}
|
||||||
exists = false
|
exists = false
|
||||||
}
|
}
|
||||||
@@ -224,7 +225,7 @@ func (b *S3FileBackend) TestConnection() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
typedErr := s3.ToErrorResponse(err)
|
typedErr := s3.ToErrorResponse(err)
|
||||||
if typedErr.Code != bucketNotFound && typedErr.Code != invalidBucket {
|
if typedErr.Code != bucketNotFound && typedErr.Code != invalidBucket {
|
||||||
return &S3FileBackendAuthError{DetailedError: "unable to check if the S3 bucket exists"}
|
return &S3FileBackendAuthError{DetailedError: fmt.Sprintf("unable to check if the S3 bucket exists: %v", typedErr)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user