You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: replace panic with proper error handling in RPC client and lookup service (#1403)
### Motivation
Fixes#1402
The current implementation uses `panic()` calls in several critical code paths within the RPC client and lookup service, which can cause the entire application to crash when encountering invalid URLs or configuration errors. This is not a good practice for a client library as it makes the application unstable and difficult to handle gracefully.
The main issues addressed:
- `NewRPCClient()` panics when creating lookup service fails
- `LookupService()` panics when parsing invalid URLs or creating lookup services
- `NewLookupService()` panics for invalid URL schemes
### Modifications
- **RPC Client Interface**: Modified `LookupService()` method signature to return `(LookupService, error)` instead of just `LookupService`
- **NewRPCClient**: Changed to return `(RPCClient, error)` and handle lookup service creation errors properly
- **LookupService Implementation**: Replaced all `panic()` calls with proper error returns and descriptive error
0 commit comments