Skip to content

Commit

Permalink
Fix error parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Apr 1, 2024
1 parent fa3ed24 commit d88eab2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Huobi.Net/Clients/SpotApi/HuobiRestClientSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ protected override Error ParseErrorResponse(int httpStatusCode, IEnumerable<KeyV
return new ServerError($"{code}, {msg}");
}

/// <inheritdoc />
protected override ServerError? TryParseError(IMessageAccessor accessor)
{
if (!accessor.IsJson)
return new ServerError(accessor.GetOriginalString());

var code = accessor.GetValue<string>(MessagePath.Get().Property("err-code"));
var msg = accessor.GetValue<string>(MessagePath.Get().Property("err-msg"));

if (code == null && msg == null)
return null;

return new ServerError($"{code}, {msg}");
}

/// <summary>
/// Construct url
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Huobi.Net/Huobi.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d88eab2

Please sign in to comment.