From dd50baa05a61d1668716845937681765e3911777 Mon Sep 17 00:00:00 2001 From: Jordan Knott Date: Sun, 23 Aug 2020 17:51:28 -0500 Subject: [PATCH] refactor: add logging to CreateTask resolver --- internal/graph/schema.resolvers.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/graph/schema.resolvers.go b/internal/graph/schema.resolvers.go index 939ca1e..9116e5b 100644 --- a/internal/graph/schema.resolvers.go +++ b/internal/graph/schema.resolvers.go @@ -180,13 +180,18 @@ func (r *mutationResolver) UpdateProjectMemberRole(ctx context.Context, input Up func (r *mutationResolver) CreateTask(ctx context.Context, input NewTask) (*db.Task, error) { taskGroupID, err := uuid.Parse(input.TaskGroupID) - createdAt := time.Now().UTC() if err != nil { + log.WithError(err).Error("issue while parsing task group ID") return &db.Task{}, err } - + createdAt := time.Now().UTC() + log.WithFields(log.Fields{"positon": input.Position, "taskGroupID": taskGroupID}).Info("creating task") task, err := r.Repository.CreateTask(ctx, db.CreateTaskParams{taskGroupID, createdAt, input.Name, input.Position}) - return &task, err + if err != nil { + log.WithError(err).Error("issue while creating task") + return &db.Task{}, err + } + return &task, nil } func (r *mutationResolver) DeleteTask(ctx context.Context, input DeleteTaskInput) (*DeleteTaskPayload, error) {