s3browser-backend/internal/errors.go

26 lines
441 B
Go
Raw Normal View History

2021-09-18 21:50:00 +00:00
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,
}
}