Added MtErrorCode used in MtExecutionException

This commit is contained in:
DW
2016-04-25 14:00:54 +03:00
parent 3bec28f817
commit 640c680933
6 changed files with 111 additions and 4 deletions
+2 -2
View File
@@ -1346,13 +1346,13 @@ namespace MtApi
if (res == null)
{
throw new MtExecutionException(-1, "Response from MetaTrader is null");
throw new MtExecutionException(MtErrorCode.MtApiCustomError, "Response from MetaTrader is null");
}
var response = JsonConvert.DeserializeObject<T>(res.Value);
if (response.ErrorCode != 0)
{
throw new MtExecutionException(response.ErrorCode, response.ErrorMessage);
throw new MtExecutionException((MtErrorCode)response.ErrorCode, response.ErrorMessage);
}
return response;