Rename LemmyError to Error to remove stutter
This commit is contained in:
parent
b22e50d439
commit
9edacef768
@ -14,12 +14,12 @@ func (he HTTPError) Error() string {
|
|||||||
return fmt.Sprintf("%d %s", he.Code, http.StatusText(he.Code))
|
return fmt.Sprintf("%d %s", he.Code, http.StatusText(he.Code))
|
||||||
}
|
}
|
||||||
|
|
||||||
// LemmyError represents an error returned by the Lemmy API
|
// Error represents an error returned by the Lemmy API
|
||||||
type LemmyError struct {
|
type Error struct {
|
||||||
ErrStr string
|
ErrStr string
|
||||||
Code int
|
Code int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (le LemmyError) Error() string {
|
func (le Error) Error() string {
|
||||||
return fmt.Sprintf("%d %s: %s", le.Code, http.StatusText(le.Code), le.ErrStr)
|
return fmt.Sprintf("%d %s: %s", le.Code, http.StatusText(le.Code), le.ErrStr)
|
||||||
}
|
}
|
||||||
|
2
lemmy.go
2
lemmy.go
@ -148,7 +148,7 @@ type emptyResponse struct {
|
|||||||
// resError returns an error if the the response contains an error
|
// resError returns an error if the the response contains an error
|
||||||
func resError(res *http.Response, err Optional[string]) error {
|
func resError(res *http.Response, err Optional[string]) error {
|
||||||
if errstr, ok := err.Value(); ok {
|
if errstr, ok := err.Value(); ok {
|
||||||
return LemmyError{
|
return Error{
|
||||||
Code: res.StatusCode,
|
Code: res.StatusCode,
|
||||||
ErrStr: errstr,
|
ErrStr: errstr,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user