26 lines
441 B
Go
26 lines
441 B
Go
|
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,
|
||
|
}
|
||
|
}
|