Rename LemmyError to Error to remove stutter

This commit is contained in:
Elara 2023-10-04 20:54:36 -07:00
parent b22e50d439
commit 9edacef768
2 changed files with 4 additions and 4 deletions

View File

@ -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)
} }

View File

@ -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,
} }