diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-07-27 04:47:19 +0300 |
---|---|---|
committer | Vladimir Shushlin <v.shushlin@gmail.com> | 2020-08-04 11:23:51 +0300 |
commit | 023ff71b6c72fc9a3f507b9d299df9ac31bb72c7 (patch) | |
tree | 028768cdf255efa6dd4a439fd95733e2cf350ea6 /internal/source | |
parent | e5106118f14674565bedf7c3dc3733ce2739acc3 (diff) |
Handle gitlab client error
Diffstat (limited to 'internal/source')
-rw-r--r-- | internal/source/domains.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/source/domains.go b/internal/source/domains.go index 81c53bd6..03abda93 100644 --- a/internal/source/domains.go +++ b/internal/source/domains.go @@ -47,6 +47,9 @@ func NewDomains(config Config) (*Domains, error) { // Creating a glClient will start polling connectivity in the background glClient, glErr := newGitlabClient(config) + if glErr != nil { + log.WithError(glErr).Warn("failed to create GitLab domains source") + } switch config.DomainConfigSource() { // TODO: handle DomainConfigSource == "gitlab" || "auto" https://gitlab.com/gitlab-org/gitlab/-/issues/218358 @@ -54,12 +57,13 @@ func NewDomains(config Config) (*Domains, error) { return domains, nil } - if glErr == nil { - domains.gitlab = glClient - } else { - log.WithError(glErr).Warn("failed to create GitLab domains source") + // return glErr when no domain config source is specified + if glErr != nil { + return nil, glErr } + domains.gitlab = glClient + return domains, nil } |