File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -95,10 +95,20 @@ export class LumClient {
9595 * Uses HTTP when the URL schema is http or https, uses WebSockets otherwise
9696 *
9797 * @param endpoint Blockchain node RPC url
98+ * @param onError Callback for errors
9899 */
99- static connect = async ( endpoint : string ) : Promise < LumClient > => {
100- const tmClient = await Tendermint34Client . connect ( endpoint ) ;
101- return new LumClient ( tmClient ) ;
100+ static connect = async ( endpoint : string , onError ?: ( e : unknown ) => void ) : Promise < LumClient > => {
101+ try {
102+ const tmClient = await Tendermint34Client . connect ( endpoint ) ;
103+
104+ return new LumClient ( tmClient ) ;
105+ } catch ( e ) {
106+ if ( onError ) {
107+ onError ( e ) ;
108+ }
109+
110+ throw e ;
111+ }
102112 } ;
103113
104114 /**
You can’t perform that action at this time.
0 commit comments