diff options
| author | Greg Steuck <greg@nest.cx> | 2021-07-09 16:02:55 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2021-07-12 06:48:27 +0200 |
| commit | a4869c92496912d05088fb91b6180ba30c553be5 (patch) | |
| tree | 48035416bc9ab78f19d05b3e0999db7e1fa5bbf7 /dashboard/dashapi/dashapi.go | |
| parent | 8f5a7b8cde529e0a19a53f79bdf9c6cad306827b (diff) | |
dashboard/dashapi: return error from dashapi.New
This will allow it to make a call to meta-server and abort early when
authentication by bearer token is impossible.
Diffstat (limited to 'dashboard/dashapi/dashapi.go')
| -rw-r--r-- | dashboard/dashapi/dashapi.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index 148b7d710..1eb536404 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -30,7 +30,7 @@ type Dashboard struct { errorHandler func(error) } -func New(client, addr, key string) *Dashboard { +func New(client, addr, key string) (*Dashboard, error) { return NewCustom(client, addr, key, http.NewRequest, http.DefaultClient.Do, nil, nil) } @@ -41,7 +41,7 @@ type ( ) func NewCustom(client, addr, key string, ctor RequestCtor, doer RequestDoer, - logger RequestLogger, errorHandler func(error)) *Dashboard { + logger RequestLogger, errorHandler func(error)) (*Dashboard, error) { return &Dashboard{ Client: client, Addr: addr, @@ -50,7 +50,7 @@ func NewCustom(client, addr, key string, ctor RequestCtor, doer RequestDoer, doer: doer, logger: logger, errorHandler: errorHandler, - } + }, nil } // Build describes all aspects of a kernel build. |
