From bfaea941c75ac7f8d3eb9d417364a7420df6c22d Mon Sep 17 00:00:00 2001 From: Jkorf Date: Wed, 13 Aug 2025 16:33:15 +0200 Subject: [PATCH] wip --- CryptoExchange.Net/Objects/Error.cs | 2 +- CryptoExchange.Net/Objects/Errors/ErrorCollection.cs | 8 ++++---- CryptoExchange.Net/Objects/Errors/ErrorType.cs | 12 ++++++------ CryptoExchange.Net/Sockets/Query.cs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CryptoExchange.Net/Objects/Error.cs b/CryptoExchange.Net/Objects/Error.cs index 23ef248..5fa23c8 100644 --- a/CryptoExchange.Net/Objects/Error.cs +++ b/CryptoExchange.Net/Objects/Error.cs @@ -159,7 +159,7 @@ namespace CryptoExchange.Net.Objects /// /// Default error info /// - protected static readonly ErrorInfo _errorInfo = new ErrorInfo(ErrorType.NetworkError, false, "Failed to complete the request to the server due to a network error"); + protected static readonly ErrorInfo _errorInfo = new ErrorInfo(ErrorType.NetworkError, true, "Failed to complete the request to the server due to a network error"); /// /// ctor diff --git a/CryptoExchange.Net/Objects/Errors/ErrorCollection.cs b/CryptoExchange.Net/Objects/Errors/ErrorCollection.cs index ab91b30..804a63a 100644 --- a/CryptoExchange.Net/Objects/Errors/ErrorCollection.cs +++ b/CryptoExchange.Net/Objects/Errors/ErrorCollection.cs @@ -44,12 +44,12 @@ namespace CryptoExchange.Net.Objects.Errors /// public ErrorInfo GetErrorInfo(string code, string? message) { - message = message ?? "-"; - if (_directMapping.TryGetValue(code, out var info)) + message = message ?? code ?? "-"; + if (_directMapping.TryGetValue(code!, out var info)) return info with { Message = message }; - if (_evaluators.TryGetValue(code, out var eva)) - return eva.ErrorTypeEvaluator.Invoke(code, message) with { Message = message }; + if (_evaluators.TryGetValue(code!, out var eva)) + return eva.ErrorTypeEvaluator.Invoke(code!, message) with { Message = message }; return ErrorInfo.Unknown with { Message = message }; } diff --git a/CryptoExchange.Net/Objects/Errors/ErrorType.cs b/CryptoExchange.Net/Objects/Errors/ErrorType.cs index 8be8aad..b488654 100644 --- a/CryptoExchange.Net/Objects/Errors/ErrorType.cs +++ b/CryptoExchange.Net/Objects/Errors/ErrorType.cs @@ -141,14 +141,10 @@ namespace CryptoExchange.Net.Objects.Errors /// SymbolNotTrading, /// - /// Order rejected due to order type or time in force restrictions + /// Order rejected due to order configuration such as order type or time in force restrictions /// OrderConfigurationRejected, /// - /// Order type not allowed - /// - OrderTypeInvalid, - /// /// There is no open position /// NoPosition, @@ -159,7 +155,11 @@ namespace CryptoExchange.Net.Objects.Errors /// /// The target object is not in the correct state for an operation /// - TargetIncorrectState + TargetIncorrectState, + /// + /// Risk management error + /// + RiskError #endregion } diff --git a/CryptoExchange.Net/Sockets/Query.cs b/CryptoExchange.Net/Sockets/Query.cs index 07fd646..56ab226 100644 --- a/CryptoExchange.Net/Sockets/Query.cs +++ b/CryptoExchange.Net/Sockets/Query.cs @@ -188,7 +188,7 @@ namespace CryptoExchange.Net.Sockets CurrentResponses++; if (CurrentResponses == RequiredResponses) - Response = message.Data; + Response = message.Data; if (Result?.Success != false) // If an error result is already set don't override that