Skip to content

Commit 66974e8

Browse files
committedOct 12, 2023
kadm: include ErrorMessage in topic response
1 parent c9d2351 commit 66974e8

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed
 

‎pkg/kadm/topics.go

+14-10
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ func (cl *Client) createTopics(ctx context.Context, dry bool, p int32, rf int16,
231231

232232
// DeleteTopicResponse contains the response for an individual deleted topic.
233233
type DeleteTopicResponse struct {
234-
Topic string // Topic is the topic that was deleted, if not using topic IDs.
235-
ID TopicID // ID is the topic ID for this topic, if talking to Kafka v2.8+ and using topic IDs.
236-
Err error // Err is any error preventing this topic from being deleted.
234+
Topic string // Topic is the topic that was deleted, if not using topic IDs.
235+
ID TopicID // ID is the topic ID for this topic, if talking to Kafka v2.8+ and using topic IDs.
236+
Err error // Err is any error preventing this topic from being deleted.
237+
ErrMessage string // ErrMessage a potential extra message describing any error.
237238
}
238239

239240
// DeleteTopicResponses contains per-topic responses for deleted topics.
@@ -311,9 +312,10 @@ func (cl *Client) DeleteTopics(ctx context.Context, topics ...string) (DeleteTop
311312
topic = *t.Topic
312313
}
313314
rs[topic] = DeleteTopicResponse{
314-
Topic: topic,
315-
ID: t.TopicID,
316-
Err: kerr.ErrorForCode(t.ErrorCode),
315+
Topic: topic,
316+
ID: t.TopicID,
317+
Err: kerr.ErrorForCode(t.ErrorCode),
318+
ErrMessage: unptrStr(t.ErrorMessage),
317319
}
318320
}
319321
return rs, nil
@@ -457,8 +459,9 @@ func (cl *Client) DeleteRecords(ctx context.Context, os Offsets) (DeleteRecordsR
457459
// CreatePartitionsResponse contains the response for an individual topic from
458460
// a create partitions request.
459461
type CreatePartitionsResponse struct {
460-
Topic string // Topic is the topic this response is for.
461-
Err error // Err is non-nil if partitions were unable to be added to this topic.
462+
Topic string // Topic is the topic this response is for.
463+
Err error // Err is non-nil if partitions were unable to be added to this topic.
464+
ErrMessage string // ErrMessage a potential extra message describing any error.
462465
}
463466

464467
// CreatePartitionsResponses contains per-topic responses for a create
@@ -584,8 +587,9 @@ func (cl *Client) createPartitions(ctx context.Context, dry bool, add, set int,
584587
rs := make(CreatePartitionsResponses)
585588
for _, t := range resp.Topics {
586589
rs[t.Topic] = CreatePartitionsResponse{
587-
Topic: t.Topic,
588-
Err: kerr.ErrorForCode(t.ErrorCode),
590+
Topic: t.Topic,
591+
Err: kerr.ErrorForCode(t.ErrorCode),
592+
ErrMessage: unptrStr(t.ErrorMessage),
589593
}
590594
}
591595
return rs, nil

0 commit comments

Comments
 (0)
Please sign in to comment.