mirror of
https://github.com/hanzokms/go-sdk.git
synced 2026-10-30 19:44:54 +00:00
23 lines
463 B
Go
23 lines
463 B
Go
package errors
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// RequestError represents an error that occurred during an API request
|
|
type RequestError struct {
|
|
Operation string `json:"operation"`
|
|
error error `json:"-"`
|
|
}
|
|
|
|
func (e *RequestError) Error() string {
|
|
return fmt.Sprintf("%s: unable to complete api request [err=%s]", e.Operation, e.error)
|
|
}
|
|
|
|
func NewRequestError(operation string, err error) error {
|
|
return &RequestError{
|
|
Operation: operation,
|
|
error: err,
|
|
}
|
|
}
|