Aias00 opened a new pull request, #997:
URL: https://github.com/apache/dubbo-go-pixiu/pull/997
## Summary
Fixes #989 Issue 3 (gateway startup path): Replace panic with proper error
returns in gateway startup command.
### Problem
The original implementation used panic in cobra command handlers:
- `PreRun`: panic when `initialize()` fails
- `Run`: panic when `start()` fails
- `stop()`: panic as placeholder for unimplemented method
Stack traces from configuration errors are not helpful to users.
### Changes
- `PreRun` → `PreRunE`: Use cobra's error handling
- `initialize()` failure now returns wrapped error to cobra
- `Run` → `RunE`: Use cobra's error handling
- `start()` failure now returns wrapped error to cobra
- `stop()`: Return error instead of panic
- Changed from `panic("implement me")` to `errors.New("stop not
implemented")`
### Classification
| Handler | Type | Classification | Fix |
|---------|------|----------------|-----|
| PreRun panic | Config/startup error | Return error to cobra |
| Run panic | Startup error | Return error to cobra |
| stop panic | Placeholder | Return error |
### Benefits
- Cobra handles errors gracefully, printing clean error messages
- Stack traces are no longer shown for configuration errors
- Users get clearer feedback on what went wrong
- Future changes to `server.Start()` can return errors properly
## Test Plan
- Build passes: `go build ./pkg/cmd/...`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]