From a4869c92496912d05088fb91b6180ba30c553be5 Mon Sep 17 00:00:00 2001 From: Greg Steuck Date: Fri, 9 Jul 2021 16:02:55 -0700 Subject: 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. --- dashboard/dashapi/dashapi.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dashboard/dashapi/dashapi.go') 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. -- cgit mrf-deployment