UNPKG

metaapi.cloud-sdk

Version:

SDK for MetaApi, a professional cloud forex API which includes MetaTrader REST API and MetaTrader websocket API. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). CopyFactory copy trading API included. (https://metaapi.cloud)

48 lines (41 loc) 1.39 kB
'use strict'; /** * Process control signal which may be configured with instructions describing how to treat an error from the process */ class ControlSignal extends Error { /** Cause error */ public cause?: Error; /** * Constructs instance * @param options options */ constructor(public options?: ControlSignal.Options) { super(options?.message || 'Process control signal'); this.cause = options?.error; } } namespace ControlSignal { /** Constructing options */ export type Options = { /** Error the process failed with */ error?: Error; /** Overriden message */ message?: string; /** * What to do with the process * - `cancel` means the process will be canceled, but only if it was not rescheduled with new options * - `failover` means a some problem arised and the process should be failovered with throttle delay * - `stop` means the process should gracefully stop, and restart without throttle delays if it is still scheduled * @default "failover" */ action?: 'cancel' | 'failover' | 'stop'; /** * Overriden log message severity. Default behaviour: * - `error` when `error` field is specified * - `warn` otherwise, when the action is `failover` * - `info` otherwise */ severity?: 'error' | 'warn' | 'info' | 'debug'; }; } export default ControlSignal;