mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-04 08:25:26 +08:00
24 lines
382 B
Go
24 lines
382 B
Go
package admin
|
|
|
|
import "errors"
|
|
|
|
type requestError struct {
|
|
detail string
|
|
}
|
|
|
|
func (e *requestError) Error() string {
|
|
return e.detail
|
|
}
|
|
|
|
func newRequestError(detail string) error {
|
|
return &requestError{detail: detail}
|
|
}
|
|
|
|
func requestErrorDetail(err error) (string, bool) {
|
|
var reqErr *requestError
|
|
if errors.As(err, &reqErr) {
|
|
return reqErr.detail, true
|
|
}
|
|
return "", false
|
|
}
|