Skip to content

Commit

Permalink
feat: add missing token error
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszjenek committed Apr 9, 2024
1 parent 645abb0 commit 63b40f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package humanitec
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/http"
Expand All @@ -20,6 +21,7 @@ const (

var (
SDKHeader = fmt.Sprintf("%s/%s", SDK, SDKVersion)
ErrMissingToken = errors.New("token is required")
)

type Config struct {
Expand Down Expand Up @@ -56,7 +58,7 @@ func (c *Client) Client() *client.Client {

func NewClient(config *Config) (*Client, error) {
if config.Token == "" {
return nil, fmt.Errorf("empty token")
return nil, ErrMissingToken
}

if config.URL == "" {
Expand Down

0 comments on commit 63b40f4

Please sign in to comment.