mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
lightning-cli: give error message when lightningd produces non-object response.
Nicer than assert() failing without showing the response. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -140,6 +140,10 @@ int main(int argc, char *argv[])
|
|||||||
errx(ERROR_TALKING_TO_LIGHTNINGD,
|
errx(ERROR_TALKING_TO_LIGHTNINGD,
|
||||||
"Malformed response '%s'", resp);
|
"Malformed response '%s'", resp);
|
||||||
|
|
||||||
|
if (toks->type != JSMN_OBJECT)
|
||||||
|
errx(ERROR_TALKING_TO_LIGHTNINGD,
|
||||||
|
"Non-object response '%s'", resp);
|
||||||
|
|
||||||
result = json_get_member(resp, toks, "result");
|
result = json_get_member(resp, toks, "result");
|
||||||
if (!result)
|
if (!result)
|
||||||
errx(ERROR_TALKING_TO_LIGHTNINGD,
|
errx(ERROR_TALKING_TO_LIGHTNINGD,
|
||||||
|
|||||||
Reference in New Issue
Block a user