Skip to content

fix: return error and stop spinner on domain delete failure#211

Open
eliajhmauve wants to merge 1 commit intozeabur:mainfrom
eliajhmauve:fix/domain-delete-error-handling
Open

fix: return error and stop spinner on domain delete failure#211
eliajhmauve wants to merge 1 commit intozeabur:mainfrom
eliajhmauve:fix/domain-delete-error-handling

Conversation

@eliajhmauve
Copy link
Copy Markdown
Contributor

Problem

domain delete has two related issues in runDeleteDomainNonInteractive:

1. Spinner not stopped on API error

Both ListDomains and RemoveDomain call return err before s.Stop(), leaving the spinner running after an error. This corrupts terminal output — the spinner animation continues rendering on top of the error message.

2. Deletion failure returns nil (exit code 0)

When RemoveDomain returns false (the API-level "failed" signal), the code logs a warning and returns nil:

if !deleteResult {
    f.Log.Warnf("Delete domain %s failed", opts.domainName)
    return nil  // exit code 0
}

Callers (scripts, CI/CD pipelines) have no way to detect that the deletion did not actually succeed.

Fix

  • Call s.Stop() before each return err in the error paths
  • Replace f.Log.Warnf(...); return nil with return fmt.Errorf(...) so failures propagate correctly

Files changed

  • internal/cmd/domain/delete/delete.go — 3-line change

Two issues in domain/delete:

1. When RemoveDomain returns false (API-level failure), the code logged
   a warning and returned nil (exit code 0), making it impossible for
   callers to detect the failure.

2. Both ListDomains and RemoveDomain error paths returned early without
   calling s.Stop(), leaving the spinner running and corrupting terminal
   output.

Fix: call s.Stop() before returning errors, and return fmt.Errorf
instead of nil when deleteResult is false.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@eliajhmauve has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 34 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 34 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00e17069-f37a-41a6-881e-6429321d69cd

📥 Commits

Reviewing files that changed from the base of the PR and between 76b8768 and 94d9533.

📒 Files selected for processing (1)
  • internal/cmd/domain/delete/delete.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants