UNPKG

protomux-rpc-client-pool

Version:

Reliably connect to one of a pool of protomux-rpc servers

33 lines (27 loc) 768 B
class ProtomuxRpcClientPoolError extends Error { constructor(msg, code, fn = ProtomuxRpcClientPoolError) { super(`${code}: ${msg}`) this.code = code if (Error.captureStackTrace) { Error.captureStackTrace(this, fn) } } get name() { return 'ProtomuxRpcClientPoolError' } static TOO_MANY_RETRIES() { return new ProtomuxRpcClientPoolError( 'Too many failed attempts to reach a server', 'TOO_MANY_RETRIES', ProtomuxRpcClientPoolError.TOO_MANY_RETRIES ) } static POOL_REQUEST_TIMEOUT() { return new ProtomuxRpcClientPoolError( 'Pool request timed out', 'POOL_REQUEST_TIMEOUT', ProtomuxRpcClientPoolError.POOL_REQUEST_TIMEOUT ) } } module.exports = ProtomuxRpcClientPoolError