style: use http status constant
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -86,7 +87,7 @@ func (c *Client) refreshWatchOrder(ctx context.Context, id int) (watchorder.Watc
|
|||||||
result, err := watchorder.FetchWatchOrder(requestCtx, c.httpClient, watchOrderURL)
|
result, err := watchorder.FetchWatchOrder(requestCtx, c.httpClient, watchOrderURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var statusError *watchorder.HTTPStatusError
|
var statusError *watchorder.HTTPStatusError
|
||||||
if errors.As(err, &statusError) && statusError.StatusCode == 404 {
|
if errors.As(err, &statusError) && statusError.StatusCode == http.StatusNotFound {
|
||||||
return watchorder.WatchOrderResult{}, watchorder.ErrWatchOrderNotFound
|
return watchorder.WatchOrderResult{}, watchorder.ErrWatchOrderNotFound
|
||||||
}
|
}
|
||||||
if errors.Is(err, watchorder.ErrWatchOrderMarkupNotFound) {
|
if errors.Is(err, watchorder.ErrWatchOrderMarkupNotFound) {
|
||||||
|
|||||||
Reference in New Issue
Block a user