commit bd9616a8e48b8a2f05021f71883d555b874c97e4 from: Oliver Lowe date: Thu Apr 27 03:19:53 2023 UTC Always return a usable Client Just because we have an error connecting to the server doesn't mean the client's configuration is invalid. Callers can inspect the error we return and decide what to do with the returned client. commit - 2f7e40d9e97ce934b511c4468f323f9fbaa27f29 commit + bd9616a8e48b8a2f05021f71883d555b874c97e4 blob - 0042626d8b6c62497ccda2ee3b29aa3ec02ba68d blob + ab224604bedd951f44e6255337c9ebeb55defde3 --- icinga.go +++ icinga.go @@ -77,10 +77,8 @@ var ErrNoMatch = errors.New("no object matches filter" // skips TLS certificate verification. func Dial(addr, username, password string, client *http.Client) (*Client, error) { c := &Client{addr, username, password, client} - if _, err := Permissions(c); err != nil { - return nil, err - } - return c, nil + _, err := Permissions(c) + return c, err } // Permissions returns the permissions granted to the Client.