Better error tracing

This commit is contained in:
Tom Wiesing 2023-11-15 11:06:30 +01:00
parent e968f0a5b9
commit 71ef3a290e
No known key found for this signature in database
9 changed files with 52 additions and 16 deletions

View file

@ -2,6 +2,7 @@ package admin
import (
"context"
"fmt"
"net/http"
"time"
@ -36,7 +37,10 @@ func (admin *Admin) Status(ctx context.Context, QuickInformation bool) (target s
// store the info for this group!
group.Go(func() (err error) {
information[i], err = instance.Info().Information(ctx, true)
return err
if err != nil {
return fmt.Errorf("instance %q: %w", instance.Slug, err)
}
return
})
}
}

View file

@ -57,14 +57,14 @@ func (admin *Admin) instanceData(ctx context.Context) http.Handler {
ctx.Pathbuilders, err = ctx.Instance.Pathbuilder().GetAll(r.Context(), server)
if err != nil {
return ctx, nil, httpx.ErrInternalServerError
return ctx, nil, err
}
prefixes := ctx.Instance.Prefixes()
ctx.NoPrefixes = prefixes.NoPrefix()
ctx.Prefixes, err = prefixes.All(r.Context(), server)
if err != nil {
return ctx, nil, httpx.ErrInternalServerError
return ctx, nil, err
}
return ctx, []templating.FlagFunc{

View file

@ -86,7 +86,7 @@ func (admin *Admin) instanceDrupal(ctx context.Context) http.Handler {
})
if err = eg.Wait(); err != nil {
return ctx, nil, httpx.ErrInternalServerError
return ctx, nil, err
}
return ctx, []templating.FlagFunc{

View file

@ -53,7 +53,7 @@ func (admin *Admin) instanceSnapshots(ctx context.Context) http.Handler {
ctx.Snapshots, err = ctx.Instance.Snapshots(r.Context())
if err != nil {
return ctx, nil, httpx.ErrInternalServerError
return ctx, nil, err
}
return ctx, []templating.FlagFunc{

View file

@ -62,7 +62,7 @@ func (admin *Admin) instanceSSH(ctx context.Context) http.Handler {
keys, err := ctx.Instance.SSH().Keys(r.Context())
if err != nil {
return ctx, nil, httpx.ErrInternalServerError
return ctx, nil, err
}
ctx.SSHKeys = make([]string, len(keys))

View file

@ -54,7 +54,7 @@ func (admin *Admin) instanceStats(ctx context.Context) http.Handler {
// read statistics
ctx.Statistics, err = ctx.Instance.Stats().Get(r.Context(), nil)
if err != nil {
return ctx, nil, httpx.ErrInternalServerError
return ctx, nil, err
}
return ctx, []templating.FlagFunc{