Skip to content

Commit c05eab0

Browse files
committed
(fix): update client to latest todo spec
1 parent ae205b3 commit c05eab0

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

cmd/client/main.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,26 @@ func main() {
4141
if err != nil {
4242
log.Fatalf("client.TodoList failed: %v", err)
4343
}
44-
log.Infow("Task",
45-
"Title", tr.Task.Title,
46-
"Description", tr.Task.Description,
47-
"Completed", tr.Task.Completed,
48-
"Last Updated", tr.Task.LastUpdated.AsTime().Format(time.RFC850),
49-
"Partition", tr.Partition,
50-
"Offset", tr.Offset,
51-
)
44+
45+
if errs := tr.GetErrors(); errs != nil {
46+
log.Errorln("Errors fetching:")
47+
for _, e := range errs.Error {
48+
log.Errorw("Error Details",
49+
"Topic", e.Topic,
50+
"Partition", e.Partition,
51+
"Error", e.Message,
52+
)
53+
}
54+
} else {
55+
todo := tr.GetTodo()
56+
log.Infow("Task",
57+
"Title", todo.Task.Title,
58+
"Description", todo.Task.Description,
59+
"Completed", todo.Task.Completed,
60+
"Last Updated", todo.Task.LastUpdated.AsTime().Format(time.RFC850),
61+
"Partition", todo.Partition,
62+
"Offset", todo.Offset,
63+
)
64+
}
5265
}
5366
}

0 commit comments

Comments
 (0)