Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create delete topic error structure #1646

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ivanvs
Copy link

@ivanvs ivanvs commented Dec 3, 2023

Connected to #957 and #129

Add information which topics cannot be deleted when user tries to delete topics.

  1. Add KafkaJSDeleteTopicError that is extending KafkaJSProtocolError
  2. Modify v0 parser for deleteTopics to handle errors better
  3. Modify admin API to deal with new deleteTopics error structure

throw e
}

if ('NOT_CONTROLLER'.includes(e.type)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this should be e.type === 'NOT_CONTROLLER'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gfoltz you are totally right. I have changed how error type is checked.

Thank you.

logger.warn('Could not delete topics', { error: e.message, retryCount, retryTime })
if (
e.name === 'KafkaJSAggregateError' &&
e.errors.some(error => error.type.includes('UNKNOWN_TOPIC_OR_PARTITION'))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be error => error.type === 'UNKNOWN_TOPIC_OR_PARTITION'. The use of includes in the original code was on an Array. But here you're using it on a string, which works but I think only accidentally, and I'm pretty sure is not what you intend.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is also changed.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants