Skip to content

Commit d5366ff

Browse files
committed
remove panic
1 parent 6808a3c commit d5366ff

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

openwsdk/api_node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ func (api *APINode) BindAppDevice() error {
237237

238238
response, err := api.node.CallSync(HostNodeID, "bindAppDevice", params)
239239
if err != nil {
240-
panic(err)
240+
return err
241241
}
242242

243243
if response.Status == owtp.StatusSuccess {
244244
return nil
245245
} else {
246-
panic(fmt.Errorf("[%d]%s", response.Status, response.Msg))
246+
return fmt.Errorf("[%d]%s", response.Status, response.Msg)
247247
}
248248

249249
return nil

openwsdk/api_node_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,3 +1089,14 @@ func TestAPINode_GetAddressBalanceList(t *testing.T) {
10891089
}
10901090
})
10911091
}
1092+
1093+
func TestAPINode_signAppDevice(t *testing.T) {
1094+
api := testNewAPINode()
1095+
appID := "1ba5e5c10ad3ebb4b6c830014be971fa"
1096+
deviceID := "ATeG6EQM7oepdY9ngZ2R5RjnH5foLJ1i55Ri1eEJsM58"
1097+
nonce := "45869586"
1098+
accessTime := int64(1679382247264467000)
1099+
appKey := "a40788a1e13b9c244d72bae6142aca09652eabdb9bfee8ca795b77e486887933"
1100+
signature := api.signAppDevice(appID, deviceID, nonce, appKey, accessTime)
1101+
log.Infof("signature: %s", signature)
1102+
}

0 commit comments

Comments
 (0)