Files
dify-cloud-kit/oss/errors.go
T
Byron.wang 4ffc7bdc65 Add multiple implement and docs (#1)
* add oss factory and s3 implement

* update tests

* add azure blob implement

* add aliyun oss implement

* add tencent cos implement

* enhance s3 create bucket logic, only create if not found

* add gcs implement

* add huawei obs implement

* add readme

* add readme

* update readme

* update readme

* add static errors

* add vendor info to tests
2025-05-28 20:39:41 +08:00

40 lines
844 B
Go

package oss
import "fmt"
var (
ErrProviderNotFound = NewCloudKitError("provider not found", "")
ErrArgumentInvalid = NewCloudKitError("argument invalid", "")
ErrProviderInit = NewCloudKitError("provider init error", "")
)
type CloudKitError struct {
Reason string
Detail string
Err error
}
func NewCloudKitError(reason string, detail string) *CloudKitError {
return &CloudKitError{
Reason: reason,
Detail: detail,
}
}
func (c *CloudKitError) Error() string {
if c.Detail != "" {
return fmt.Sprintf("reason: %s; detail: %s; error: %v", c.Reason, c.Detail, c.Err)
}
return fmt.Sprintf("reason: %s; error: %v", c.Reason, c.Err)
}
func (c *CloudKitError) WithDetail(detail string) *CloudKitError {
c.Detail = detail
return c
}
func (c *CloudKitError) WithError(err error) *CloudKitError {
c.Err = err
return c
}