From c05eab02699839ee3e353dbb0f876502d03384e7 Mon Sep 17 00:00:00 2001 From: Kamesh Sampath Date: Wed, 6 Dec 2023 08:14:03 +0530 Subject: [PATCH] (fix): update client to latest todo spec --- cmd/client/main.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index c6842fb..39d7789 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -41,13 +41,26 @@ func main() { if err != nil { log.Fatalf("client.TodoList failed: %v", err) } - log.Infow("Task", - "Title", tr.Task.Title, - "Description", tr.Task.Description, - "Completed", tr.Task.Completed, - "Last Updated", tr.Task.LastUpdated.AsTime().Format(time.RFC850), - "Partition", tr.Partition, - "Offset", tr.Offset, - ) + + if errs := tr.GetErrors(); errs != nil { + log.Errorln("Errors fetching:") + for _, e := range errs.Error { + log.Errorw("Error Details", + "Topic", e.Topic, + "Partition", e.Partition, + "Error", e.Message, + ) + } + } else { + todo := tr.GetTodo() + log.Infow("Task", + "Title", todo.Task.Title, + "Description", todo.Task.Description, + "Completed", todo.Task.Completed, + "Last Updated", todo.Task.LastUpdated.AsTime().Format(time.RFC850), + "Partition", todo.Partition, + "Offset", todo.Offset, + ) + } } }