about summary refs log tree commit diff stats
path: root/internal/server
diff options
context:
space:
mode:
authorAlan Pearce2024-11-28 15:12:00 +0100
committerAlan Pearce2024-11-28 15:12:00 +0100
commitb94f66cfe5bf87ec6d2a32448ca5c55ba118c7aa (patch)
treeeb6f951b3a0959c6ace7be6f111124791e90c54d /internal/server
parent183b0c8b5edbcf4224d4dd3905ca483204522656 (diff)
downloadwebsite-b94f66cfe5bf87ec6d2a32448ca5c55ba118c7aa.tar.lz
website-b94f66cfe5bf87ec6d2a32448ca5c55ba118c7aa.tar.zst
website-b94f66cfe5bf87ec6d2a32448ca5c55ba118c7aa.zip
Use errors.WithMessage in place of .Wrap HEAD main
Diffstat (limited to 'internal/server')
-rw-r--r--internal/server/server.go4
-rw-r--r--internal/server/tls.go12
2 files changed, 8 insertions, 8 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 5c92139..b327f3d 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -180,7 +180,7 @@ func New(runtimeConfig *Config, log *log.Logger) (*Server, error) {
 	loggingMux := http.NewServeMux()
 	mux, err := website.NewMux(config, runtimeConfig.Root, log.Named("website"))
 	if err != nil {
-		return nil, errors.Wrap(err, "could not create website mux")
+		return nil, errors.WithMessage(err, "could not create website mux")
 	}
 
 	if runtimeConfig.Redirect {
@@ -238,7 +238,7 @@ func (s *Server) serve(tls bool) error {
 
 func (s *Server) Start() error {
 	if err := s.serve(s.runtimeConfig.TLS); err != http.ErrServerClosed {
-		return errors.Wrap(err, "error creating/closing server")
+		return errors.WithMessage(err, "error creating/closing server")
 	}
 
 	return nil
diff --git a/internal/server/tls.go b/internal/server/tls.go
index 2bb5ce4..716495c 100644
--- a/internal/server/tls.go
+++ b/internal/server/tls.go
@@ -73,13 +73,13 @@ func (s *Server) serveTLS() (err error) {
 		rc := &redisConfig{}
 		_, err = conf.Parse("REDIS", rc)
 		if err != nil {
-			return errors.Wrap(err, "could not parse redis config")
+			return errors.WithMessage(err, "could not parse redis config")
 		}
 
 		pdns := &powerdns.Provider{}
 		_, err = conf.Parse("POWERDNS", pdns)
 		if err != nil {
-			return errors.Wrap(err, "could not parse PowerDNS ACME config")
+			return errors.WithMessage(err, "could not parse PowerDNS ACME config")
 		}
 
 		issuer = certmagic.NewACMEIssuer(cfg, certmagic.ACMEIssuer{
@@ -113,7 +113,7 @@ func (s *Server) serveTLS() (err error) {
 			Context: context.Background(),
 		})
 		if err != nil {
-			return errors.Wrap(err, "could not provision redis storage")
+			return errors.WithMessage(err, "could not provision redis storage")
 		}
 	}
 	cfg.Issuers[0] = issuer
@@ -124,7 +124,7 @@ func (s *Server) serveTLS() (err error) {
 		log.Named("listenfd"),
 	)
 	if err != nil {
-		return errors.Wrap(err, "could not bind plain socket")
+		return errors.WithMessage(err, "could not bind plain socket")
 	}
 
 	go func(ln net.Listener, srv *http.Server) {
@@ -169,7 +169,7 @@ func (s *Server) serveTLS() (err error) {
 	)
 	err = cfg.ManageAsync(context.TODO(), certificateDomains)
 	if err != nil {
-		return errors.Wrap(err, "could not enable TLS")
+		return errors.WithMessage(err, "could not enable TLS")
 	}
 	tlsConfig := cfg.TLSConfig()
 	tlsConfig.NextProtos = append([]string{"h2", "http/1.1"}, tlsConfig.NextProtos...)
@@ -181,7 +181,7 @@ func (s *Server) serveTLS() (err error) {
 		log.Named("listenfd"),
 	)
 	if err != nil {
-		return errors.Wrap(err, "could not bind tls socket")
+		return errors.WithMessage(err, "could not bind tls socket")
 	}
 
 	return s.Serve(sln)