How to use the ccxt.NotSupported function in ccxt

To help you get started, we’ve selected a few ccxt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ccxt-rest / ccxt-rest / api / helpers / controller-helper.js View on Github external
try {
      exchangeId = getExchangeId(req)
    } catch (error) {
      exchangeId = '???invalid_token???'
    }
    console.error(`[${exchangeId}] Error on ${label}`);
    console.trace(error)
    if (error instanceof ccxt.AuthenticationError) {
      res.status(401).send();
    } else if (error instanceof ccxt.InvalidNonce || error instanceof ccxtRestErrors.AuthError) {
      res.status(403).send();
    } else if (error instanceof ccxt.OrderNotFound || error instanceof ccxtRestErrors.UnknownExchangeNameError) {
      res.status(404).send();
    } else if (error instanceof ccxt.InvalidOrder || error instanceof ccxt.InsufficientFunds) {
      res.status(400).send();
    } else if (error instanceof ccxt.NotSupported || error instanceof ccxtRestErrors.UnsupportedApiError) {
      res.status(501).send();
    } else if (error instanceof ccxtRestErrors.BrokenExchangeError) {
      res.status(503).send();
    } else if (error instanceof ccxt.NetworkError) {
      res.status(504).send();
    } else {
      res.status(500).send();
    }
}