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

Problem with NewBinanceWApiException #108

Closed
khoofard opened this issue Nov 27, 2018 · 3 comments
Closed

Problem with NewBinanceWApiException #108

khoofard opened this issue Nov 27, 2018 · 3 comments
Assignees

Comments

@khoofard
Copy link

I tried a withdrawal using API Keys that did not have withdrawal permissions. The exception being returned from this method does not include the "You don't have permission." message in the JSON variable. So unless I debugged it, I could not tell why my withdrawal failed.

Here is a screen shot from debugging that shows the key fields in the immediate window.

image

Absolutely love this code! Thank you so much!

@sonvister sonvister self-assigned this Nov 28, 2018
@sonvister
Copy link
Owner

@khoofard, I'm glad you enjoy working with the code and thanks for this information.

I'll make the following change:

if (!string.IsNullOrWhiteSpace(error))
{
    if (error.IsJsonObject())
    {
        try // to parse server error response.
        {
            var jError = JObject.Parse(error);

            errorCode = jError["code"]?.Value<int>() ?? 0;
            errorMessage = jError["msg"]?.Value<string>();
        }
        catch (Exception e)
        {
            _logger?.LogError(e, $"{nameof(BinanceApi)}.{methodName} failed to parse server error response: \"{error}\"");
            throw;
        }
    }
    else
    {
        errorMessage = error;
    }
}

sonvister added a commit that referenced this issue Nov 28, 2018
@sonvister
Copy link
Owner

Test results using BinanceConsoleApp:

withdraw btc 3JjG3tRR1dx98UJyNdpzpkrxRjXmPfQHk9 0.01
fail: Binance.BinanceApi[0]
      BinanceApi.WithdrawAsync: Failed (asset: "BTC") - "You don't have permission." [NO CODE]

! Exception: BinanceApi.WithdrawAsync: Failed (asset: "BTC") - "You don't have permission." [NO CODE]

This change will be in 0.2.0-beta9... but, I think I'll wait a bit before creating that release.

@khoofard
Copy link
Author

Thank you for such a quick response. What is the best way to contact you? Here? Email?

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

2 participants