diff --git a/tools/walletextension/container/walletextension_container.go b/tools/walletextension/container/walletextension_container.go index 0214b6cf72..f68b71d713 100644 --- a/tools/walletextension/container/walletextension_container.go +++ b/tools/walletextension/container/walletextension_container.go @@ -149,21 +149,29 @@ func NewWalletExtensionContainer( } } -// TODO Start should not be a locking process +// Start starts the wallet extension container func (w *WalletExtensionContainer) Start() error { httpErrChan := w.httpServer.Start() wsErrChan := w.wsServer.Start() - select { - case err := <-httpErrChan: - if !errors.Is(err, http.ErrServerClosed) { - panic(err) + // Start a goroutine for handling HTTP server errors + go func() { + for err := range httpErrChan { + if !errors.Is(err, http.ErrServerClosed) { + w.logger.Error("HTTP server error: %v", err) + } } - case err := <-wsErrChan: - if !errors.Is(err, http.ErrServerClosed) { - panic(err) + }() + + // Start a goroutine for handling WebSocket server errors + go func() { + for err := range wsErrChan { + if !errors.Is(err, http.ErrServerClosed) { + w.logger.Error("WebSocket server error: %v", err) + } } - } + }() + return nil }