file-system/internal/common/s3_errors.go
向宁 b5df6445e5 refactor: commit all pending file_system changes
- Restructure handlers into file_commands/file_queries/file_handlers
- Add gRPC auth client, JWT middleware, rate limiting, request ID
- Add common utilities: logger, sanitizer, s3_errors
- Add unit tests for config, mediator, auth, request_id, sanitize
- Add proto definitions and generated code
- Remove old web UI pages
- Add .dockerignore and .env.example
2026-05-17 22:20:02 +08:00

27 lines
470 B
Go

package common
import (
"errors"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
)
func WrapS3Error(err error) error {
if err == nil {
return nil
}
var (
noSuchBucket *types.NoSuchBucket
noSuchKey *types.NoSuchKey
notFound *types.NotFound
)
if errors.As(err, &noSuchBucket) || errors.As(err, &noSuchKey) || errors.As(err, &notFound) {
return NewNotFoundError("resource not found")
}
return fmt.Errorf("storage operation failed")
}