MQL5-SyntheticTestHarness/MQL5/Include/SyntheticTestHarness/ErrorCodes.mqh

33 lines
1.8 KiB
MQL5
Raw Permalink Normal View History

//+------------------------------------------------------------------+
//| ErrorCodes.mqh |
//| Synthetic Test Harness for MetaTrader 5 |
//| Institutional Architecture in MQL5 - Part 1 Series |
//+------------------------------------------------------------------+
2026-07-18 22:59:46 -03:00
#ifndef SYNTHETIC_TEST_HARNESS_ERROR_CODES_MQH
#define SYNTHETIC_TEST_HARNESS_ERROR_CODES_MQH
//+------------------------------------------------------------------+
//| Named error constants for synthetic test scenarios. |
//| |
//| ADR-001: MQL5 has no exceptions (try/catch/throw). We use named |
//| constants instead of raw integers so error-handling paths are |
//| self-documenting and grep-searchable. |
//+------------------------------------------------------------------+
#define SYNTH_ERR_NONE 0 // No error - execution succeeded
#define SYNTH_ERR_REQUOTE 10004 // ERR_REQUOTE
#define SYNTH_ERR_REJECT 10006 // ERR_REQUEST_REJECTED
#define SYNTH_ERR_TIMEOUT 10012 // ERR_TIMEOUT
#define SYNTH_ERR_OFF_QUOTES 10017 // ERR_OFF_QUOTES
//+------------------------------------------------------------------+
//| IsExecutionError: guard function replacing raw int comparisons. |
//| Callers use this instead of checking error codes against zero |
//| directly, centralizing the "what counts as failure" logic. |
//+------------------------------------------------------------------+
bool IsExecutionError(const int error_code)
{
return(error_code != SYNTH_ERR_NONE);
}
//+------------------------------------------------------------------+
2026-07-18 22:59:46 -03:00
#endif