Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2020-12-09 12:16:08 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-01-14 02:44:13 +0300
commitb82ad758ccbfae66c719fedebdfa3f74d27ab215 (patch)
tree055e3c71c3c8ea1514cbd7fcd79c784a571e3c24 /app.go
parentf2d6fa65a7e3cefab6e35a7807b5f95f4981cedb (diff)
Move error to domain package
Define ErrDomainDoesNotExist in the domain package so it can be returned by the Resolver and handled appropriatley.
Diffstat (limited to 'app.go')
-rw-r--r--app.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/app.go b/app.go
index 1352b630..ec0c36a5 100644
--- a/app.go
+++ b/app.go
@@ -2,6 +2,7 @@ package main
import (
"crypto/tls"
+ "errors"
"fmt"
"net"
"net/http"
@@ -150,8 +151,8 @@ func (a *theApp) routingMiddleware(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// if we could not retrieve a domain from domains source we break the
// middleware chain and simply respond with 502 after logging this
- host, domain, err := a.getHostAndDomain(r)
- if err != nil {
+ host, d, err := a.getHostAndDomain(r)
+ if err != nil && !errors.Is(err, domain.ErrDomainDoesNotExist) {
metrics.DomainsSourceFailures.Inc()
log.WithError(err).Error("could not fetch domain information from a source")
@@ -159,7 +160,7 @@ func (a *theApp) routingMiddleware(handler http.Handler) http.Handler {
return
}
- r = request.WithHostAndDomain(r, host, domain)
+ r = request.WithHostAndDomain(r, host, d)
handler.ServeHTTP(w, r)
})