Skip to content

better handling of json.error #9

@pinheadmz

Description

@pinheadmz

This issue is similar to bcoin-org/brq#7 in that I'm getting unexpected behavior when using bcurl for APIs besides bcoin.

See here:
https://github.com/bcoin-org/bcurl/blob/master/lib/client.js#L211-L217

This gets broken by Kraken's API, which is already frustrating for a few other reasons, but one of them is this -- the API always returns an error property in the JSON:

https://api.kraken.com/0/public/Ticker?pair=XBTUSD
-->

{"error":[],"result":{"XXBTZUSD":{"a":["3536.10000","2","2.000"],"b":["3535.30000","1","1.000"],"c":["3531.80000","1.58333841"],"v":["8259.75520827","9590.27330937"],"p":["3510.71489","3507.83774"],"t":[12317,14569],"l":["3433.90000","3433.90000"],"h":["3579.80000","3579.80000"],"o":"3502.00000"}}}

Even though the error array is empty, bcurl detects that the property is there and throws without returning the rest of the object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions