Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better handling of json.error #9

Closed
pinheadmz opened this issue Dec 18, 2018 · 2 comments
Closed

better handling of json.error #9

pinheadmz opened this issue Dec 18, 2018 · 2 comments

Comments

@pinheadmz
Copy link
Member

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.

@BluSyn
Copy link
Contributor

BluSyn commented Mar 22, 2019

Solved in #10

@BluSyn BluSyn closed this as completed Mar 22, 2019
@braydonf
Copy link

So bcurl may not be that useful in other such cases. The error handling is fairly specific to how the error is formatted and how bcoin and bweb returns it. This library should probably have a different name, merge with brq (#18) to correspond as the client for bweb, or an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants