feat: improve instance not found error (#7413)

* feat: improve instance not found error

* unit tests

* check if is templatable

* lint

* assert

* compile tests

* remove error templates

* link to instance not found page

* fmt

* cleanup

* lint
This commit is contained in:
Elio Bischof
2024-02-28 11:49:57 +01:00
committed by GitHub
parent 062d153cfe
commit f4c72cbe14
22 changed files with 55 additions and 38 deletions

View File

@@ -6,6 +6,7 @@ import (
_ "embed"
"encoding/json"
"errors"
"fmt"
"strings"
"time"
@@ -196,7 +197,12 @@ var (
func (q *Queries) InstanceByHost(ctx context.Context, host string) (_ authz.Instance, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
defer func() {
if err != nil {
err = fmt.Errorf("unable to get instance by host %s: %w", host, err)
}
span.EndWithError(err)
}()
domain := strings.Split(host, ":")[0] // remove possible port
instance, scan := scanAuthzInstance(host, domain)