@@ -122,12 +122,12 @@ func runCmd(opts *Options) error {
122122 }
123123
124124 // perform delete topic API request
125- _ , httpRes , topicErr := api .GetTopic (context .Background (), opts .topicName ).
125+ _ , httpRes , err := api .GetTopic (context .Background (), opts .topicName ).
126126 Execute ()
127127
128- if topicErr . Error () != "" {
128+ if err != nil {
129129 if httpRes == nil {
130- return topicErr
130+ return err
131131 }
132132 if httpRes .StatusCode == 404 {
133133 return errors .New (localizer .MustLocalize (& localizer.Config {
@@ -145,7 +145,7 @@ func runCmd(opts *Options) error {
145145 Message : localizer .MustLocalizeFromID ("kafka.topic.delete.input.name.message" ),
146146 }
147147 var userConfirmedName string
148- if err : = survey .AskOne (promptConfirmName , & userConfirmedName ); err != nil {
148+ if err = survey .AskOne (promptConfirmName , & userConfirmedName ); err != nil {
149149 return err
150150 }
151151
@@ -162,11 +162,11 @@ func runCmd(opts *Options) error {
162162 }
163163
164164 // perform delete topic API request
165- httpRes , topicErr = api .DeleteTopic (context .Background (), opts .topicName ).
165+ httpRes , err = api .DeleteTopic (context .Background (), opts .topicName ).
166166 Execute ()
167- if topicErr . Error () != "" {
167+ if err != nil {
168168 if httpRes == nil {
169- return topicErr
169+ return err
170170 }
171171
172172 switch httpRes .StatusCode {
@@ -200,9 +200,9 @@ func runCmd(opts *Options) error {
200200 TemplateData : map [string ]interface {}{
201201 "Name" : kafkaInstance .GetName (),
202202 },
203- }), topicErr )
203+ }), err )
204204 default :
205- return topicErr
205+ return err
206206 }
207207 }
208208
0 commit comments