Browse Source

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>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
a5e08e7f79
  1. 4
      daemon/lightning-cli.c

4
daemon/lightning-cli.c

@ -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,

Loading…
Cancel
Save