1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-08-31 12:42:00 +00:00
This commit is contained in:
Jkorf 2025-08-13 16:33:15 +02:00
parent 2c1d58e3f6
commit bfaea941c7
4 changed files with 12 additions and 12 deletions

View File

@ -159,7 +159,7 @@ namespace CryptoExchange.Net.Objects
/// <summary>
/// Default error info
/// </summary>
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");
/// <summary>
/// ctor

View File

@ -44,12 +44,12 @@ namespace CryptoExchange.Net.Objects.Errors
/// </summary>
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 };
}

View File

@ -141,14 +141,10 @@ namespace CryptoExchange.Net.Objects.Errors
/// </summary>
SymbolNotTrading,
/// <summary>
/// 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
/// </summary>
OrderConfigurationRejected,
/// <summary>
/// Order type not allowed
/// </summary>
OrderTypeInvalid,
/// <summary>
/// There is no open position
/// </summary>
NoPosition,
@ -159,7 +155,11 @@ namespace CryptoExchange.Net.Objects.Errors
/// <summary>
/// The target object is not in the correct state for an operation
/// </summary>
TargetIncorrectState
TargetIncorrectState,
/// <summary>
/// Risk management error
/// </summary>
RiskError
#endregion
}

View File

@ -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