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)

37 lines (33 loc) 1.05 kB
'use strict'; /** * Error which indicates that user doesn't have access to a method */ export default class MethodAccessError extends Error { /** * Constructs the error * @param {string} methodName Name of method * @param {string} accessType Type of method access */ constructor(methodName, accessType = 'api') { let errorMessage = ''; switch (accessType) { case 'api': { errorMessage = `You can not invoke ${methodName} method, because you have connected with API access token. ` + 'Please use account access token to invoke this method.'; break; } case 'account': { errorMessage = `You can not invoke ${methodName} method, because you have connected with account access token. ` + 'Please use API access token from https://app.metaapi.cloud/api-access/generate-token page ' + 'to invoke this method.'; break; } default: { errorMessage = ''; break; } } super(errorMessage); this.name = 'MethodAccessError'; } }