socket: make errors public

This commit is contained in:
Kory Prince 2021-04-27 10:29:48 -05:00
parent d00ec9d474
commit 90afa97083
1 changed files with 5 additions and 5 deletions

View File

@ -12,8 +12,8 @@ import (
"strconv" "strconv"
) )
var socketNotFoundError = errors.New("unable to locate CUPS socket") var SocketNotFoundError = errors.New("unable to locate CUPS socket")
var certNotFoundError = errors.New("unable to locate CUPS certificate") var CertNotFoundError = errors.New("unable to locate CUPS certificate")
var ( var (
DefaultSocketSearchPaths = []string{"/var/run/cupsd", "/var/run/cups/cups.sock", "/run/cups/cups.sock"} DefaultSocketSearchPaths = []string{"/var/run/cupsd", "/var/run/cups/cups.sock", "/run/cups/cups.sock"}
@ -61,7 +61,7 @@ func (h *SocketAdapter) SendRequest(url string, r *Request, _ io.Writer) (*Respo
// if cert isn't found, do a request to generate it // if cert isn't found, do a request to generate it
cert, err := h.GetCert() cert, err := h.GetCert()
if err != nil && err != certNotFoundError { if err != nil && err != CertNotFoundError {
return nil, err return nil, err
} }
@ -137,7 +137,7 @@ func (h *SocketAdapter) GetSocket() (string, error) {
} }
} }
return "", socketNotFoundError return "", SocketNotFoundError
} }
//GetCert returns the current CUPs authentication certificate by searching CertSearchPaths //GetCert returns the current CUPs authentication certificate by searching CertSearchPaths
@ -161,7 +161,7 @@ func (h *SocketAdapter) GetCert() (string, error) {
return buf.String(), nil return buf.String(), nil
} }
return "", certNotFoundError return "", CertNotFoundError
} }
func (h *SocketAdapter) GetHttpUri(namespace string, object interface{}) string { func (h *SocketAdapter) GetHttpUri(namespace string, object interface{}) string {