chore: add context and error handling

This commit is contained in:
2022-12-17 14:36:42 +01:00
parent 80d3c44cb0
commit 98a679d2d3
4 changed files with 23 additions and 16 deletions
+4 -4
View File
@@ -24,7 +24,7 @@ func (r *mutationResolver) UpdateSubGraph(ctx context.Context, input model.Input
if subGraphId != "" {
subGraph.BaseAggregate = eventsourced.BaseAggregateFromString(subGraphId)
}
handler, err := r.handler(subGraph)
handler, err := r.handler(ctx, subGraph)
if err != nil {
return nil, err
}
@@ -36,7 +36,7 @@ func (r *mutationResolver) UpdateSubGraph(ctx context.Context, input model.Input
serviceSDLs := []string{input.Sdl}
services, _ := r.Cache.Services(input.Ref, "")
for _, id := range services {
sg, err := r.fetchSubGraph(id)
sg, err := r.fetchSubGraph(ctx, id)
if err != nil {
return nil, err
}
@@ -48,7 +48,7 @@ func (r *mutationResolver) UpdateSubGraph(ctx context.Context, input model.Input
if err != nil {
return nil, err
}
_, err = handler.Handle(domain.UpdateSubGraph{
_, err = handler.Handle(ctx, domain.UpdateSubGraph{
Ref: input.Ref,
Service: input.Service,
Url: input.URL,
@@ -89,7 +89,7 @@ func (r *queryResolver) Supergraph(ctx context.Context, ref string, isAfter *str
}
subGraphs := make([]*model.SubGraph, len(services))
for i, id := range services {
sg, err := r.fetchSubGraph(id)
sg, err := r.fetchSubGraph(ctx, id)
if err != nil {
return nil, err
}