@@ -328,13 +328,15 @@ func (w *wasmClient) InvokeRPC(_ js.Value, args []js.Value) interface{} {
328
328
if len (args ) != 3 {
329
329
log .Errorf ("Invalid use of wasmClientInvokeRPC, need 3 " +
330
330
"parameters: rpcName, request, callback" )
331
+
331
332
return js .ValueOf ("invalid use of wasmClientInvokeRPC, " +
332
333
"need 3 parameters: rpcName, request, callback" )
333
334
}
334
335
335
336
if w .lndConn == nil {
336
337
log .Errorf ("Attempted to invoke RPC but connection is not " +
337
338
"ready" )
339
+
338
340
return js .ValueOf ("RPC connection not ready" )
339
341
}
340
342
@@ -345,27 +347,19 @@ func (w *wasmClient) InvokeRPC(_ js.Value, args []js.Value) interface{} {
345
347
method , ok := w .registry [rpcName ]
346
348
if ! ok {
347
349
log .Errorf ("RPC method '%s' not found in registry" , rpcName )
350
+
348
351
return js .ValueOf ("rpc with name " + rpcName + " not found" )
349
352
}
350
353
351
354
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
-
361
355
log .Infof ("Calling '%s' on RPC with request %s" ,
362
356
rpcName , requestJSON )
363
357
cb := func (resultJSON string , err error ) {
364
358
if err != nil {
365
359
log .Errorf ("RPC '%s' failed: %v" , rpcName , err )
366
360
jsCallback .Invoke (js .ValueOf (err .Error ()))
367
361
} else {
368
- log .Debugf ("RPC '%s' succeeded with result: %s" ,
362
+ log .Tracef ("RPC '%s' succeeded with result: %s" ,
369
363
rpcName , resultJSON )
370
364
jsCallback .Invoke (js .ValueOf (resultJSON ))
371
365
}
0 commit comments