the big refactor

This commit is contained in:
2021-09-24 15:39:23 +02:00
parent a3e66cd351
commit ed932e3c92
13 changed files with 196 additions and 171 deletions

25
internal/errors/errors.go Normal file
View File

@@ -0,0 +1,25 @@
package s3browser
import "fmt"
type ExtendedError struct {
Message string
Code string
}
func (err *ExtendedError) Error() string {
return err.Message
}
func (err *ExtendedError) Extensions() map[string]interface{} {
return map[string]interface{}{
"code": err.Code,
}
}
func ExtendError(code, format string, a ...interface{}) *ExtendedError {
return &ExtendedError{
Message: fmt.Sprintf(format, a...),
Code: code,
}
}