diff --git a/eigenda/proxy.go b/eigenda/proxy.go index 687c24b92..1639ca0d0 100644 --- a/eigenda/proxy.go +++ b/eigenda/proxy.go @@ -128,6 +128,10 @@ func (c *client) GetData(ctx context.Context, comm []byte) ([]byte, error) { return nil, err } + if resp.StatusCode == http.StatusServiceUnavailable { + return nil, ErrServiceUnavailable + } + if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("received error response, code=%d, msg = %s", resp.StatusCode, string(b)) } @@ -155,6 +159,10 @@ func (c *client) SetData(ctx context.Context, b []byte) ([]byte, error) { return nil, err } + if resp.StatusCode == http.StatusServiceUnavailable { + return nil, ErrServiceUnavailable + } + if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("failed to store data: %v, err = %s", resp.StatusCode, string(b)) }