@@ -328,13 +328,15 @@ func (w *wasmClient) InvokeRPC(_ js.Value, args []js.Value) interface{} {
328328	if  len (args ) !=  3  {
329329		log .Errorf ("Invalid use of wasmClientInvokeRPC, need 3 " + 
330330			"parameters: rpcName, request, callback" )
331+ 
331332		return  js .ValueOf ("invalid use of wasmClientInvokeRPC, "  + 
332333			"need 3 parameters: rpcName, request, callback" )
333334	}
334335
335336	if  w .lndConn  ==  nil  {
336337		log .Errorf ("Attempted to invoke RPC but connection is not " + 
337338			"ready" )
339+ 
338340		return  js .ValueOf ("RPC connection not ready" )
339341	}
340342
@@ -345,27 +347,19 @@ func (w *wasmClient) InvokeRPC(_ js.Value, args []js.Value) interface{} {
345347	method , ok  :=  w .registry [rpcName ]
346348	if  ! ok  {
347349		log .Errorf ("RPC method '%s' not found in registry" , rpcName )
350+ 
348351		return  js .ValueOf ("rpc with name "  +  rpcName  +  " not found" )
349352	}
350353
351354	go  func () {
352- 		defer  func () {
353- 			if  r  :=  recover (); r  !=  nil  {
354- 				errMsg  :=  fmt .Sprintf ("Panic in RPC call: " + 
355- 					"%v" , r )
356- 				log .Errorf ("%s\n %s" , errMsg , debug .Stack ())
357- 				jsCallback .Invoke (js .ValueOf (errMsg ))
358- 			}
359- 		}()
360- 
361355		log .Infof ("Calling '%s' on RPC with request %s" ,
362356			rpcName , requestJSON )
363357		cb  :=  func (resultJSON  string , err  error ) {
364358			if  err  !=  nil  {
365359				log .Errorf ("RPC '%s' failed: %v" , rpcName , err )
366360				jsCallback .Invoke (js .ValueOf (err .Error ()))
367361			} else  {
368- 				log .Debugf ("RPC '%s' succeeded with result: %s" ,
362+ 				log .Tracef ("RPC '%s' succeeded with result: %s" ,
369363					rpcName , resultJSON )
370364				jsCallback .Invoke (js .ValueOf (resultJSON ))
371365			}
0 commit comments