get aiSummary and documents refactor
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package ai_summarizer
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
)
|
||||
|
||||
// isMinioNotFound reports whether err indicates the object or bucket key is missing.
|
||||
// The MinIO Go SDK often returns success from GetObject and surfaces NoSuchKey on Read.
|
||||
func isMinioNotFound(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
var minioErr minio.ErrorResponse
|
||||
if errors.As(err, &minioErr) {
|
||||
if minioErr.StatusCode == http.StatusNotFound {
|
||||
return true
|
||||
}
|
||||
switch strings.ToLower(minioErr.Code) {
|
||||
case "nosuchkey", "notfound":
|
||||
return true
|
||||
}
|
||||
}
|
||||
msg := strings.ToLower(err.Error())
|
||||
return strings.Contains(msg, "does not exist") ||
|
||||
strings.Contains(msg, "nosuchkey") ||
|
||||
strings.Contains(msg, "not found")
|
||||
}
|
||||
Reference in New Issue
Block a user