beekeeper | Misleading information in error message while opening wallet thorough `open` api call
The invalid field name in the query during wallet opening (probably in others too) is causing an error - it is proper behavior. Yet, an error message is misleading, for example (wallet exists) :
query:
curl -s --data '{
"jsonrpc": "2.0",
"method": "beekeeper_api.open",
"params": {
"token":"b7f114af3514806266f206b17b533d08e2089c48f7294977337c1ea336b9df11",
"name":"teraz"
},
"id": 1
}' http://127.0.0.1:6666 | jq
will produce:
{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Assert Exception:valid_filename(name): Invalid filename, path not allowed in wallet name ",
"data": {
"code": 10,
"name": "assert_exception",
"message": "Assert Exception",
"stack": [
{
"context": {
"level": "error",
"file": "wallet_manager_impl.cpp",
"line": 63,
"method": "open",
"hostname": "",
"timestamp": "2023-08-25T12:10:35"
},
"format": "Invalid filename, path not allowed in wallet name ${n}",
"data": {
"n": ""
}
}
],
"extension": {
"assertion_expression": "valid_filename(name)"
}
}
},
"id": 1
}
In the error message, we can see that the problem is with the wallet name "Assert Exception:valid_filename(name): Invalid filename, path not allowed in wallet name ",
however the real problem is with the query name because it should be wallet_name
instead of name
.
We should set an error regarding proper query syntax.