Surface unhandled exceptions in CLI and TestHarness#62
Conversation
The outer catch in CommandExecutionService silently swallowed any exception not handled by BaseCommandHandler's specific catches (auth, ServiceBus, cancellation), so failures like missing queues or unexpected errors exited with code 1 and no output. Print the exception to stderr in the safety net, and add a generic catch in BaseCommandHandler so handler errors get formatted via IConsoleOutput with stack traces under --verbose. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR enhances error handling in CLI and TestHarness components by capturing exceptions and emitting detailed diagnostic information to standard error, including exception type, message, and stack traces with colored console output, while maintaining existing control flow and exit code behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
SummarySummary
CoverageServiceBusToolset.Application - 64.4%
|
Summary
catch (Exception)in bothCommandExecutionServicefiles (CLI and TestHarness) silently swallowed exceptions, setting exit code 1 with no output. Commands likegenerate-dlqfailed without any visible error.BaseCommandHandleronly caughtAuthenticationFailedException,ServiceBusException, andOperationCanceledException— anything else (e.g.MessagingEntityNotFoundException, NREs, argument exceptions) bubbled up to the silent outer catch.Fix
CommandExecutionService(both projects) now printsex.GetType().Name,ex.Message, and fullex.ToString()to stderr in red before setting exit code 1.BaseCommandHandler(both projects) gained a genericcatch (Exception)so expected handler errors get formatted viaIConsoleOutput.Error, with the full stack trace shown when--verboseis passed.BaseCommandHandlerproduces clean user-facing messages;CommandExecutionServiceis the safety net for failures outside a handler (DI resolution, parser, etc.).Test plan
dotnet run --project src/ServiceBusToolset.TestHarness -- generate-dlq -n <bad-namespace> -q <bad-queue> -c 1and confirm the auth/ServiceBus error is now visible.🤖 Generated with Claude Code
Summary by CodeRabbit