How to use the @feathersjs/errors.convert function in @feathersjs/errors

To help you get started, we’ve selected a few @feathersjs/errors 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 kalisio / feathers-distributed / src / service.js View on Github external
async create (data, params) {
    debug('Requesting create() remote service on path ' + this.path, data, params)
    try {
      const result = await this.requester.send({ type: 'create', data, params })
      debug('Successfully create() remote service on path ' + this.path)
      return result
    } catch (error) {
      throw convert(error)
    }
  }
github kalisio / feathers-distributed / src / service.js View on Github external
async update (id, data, params) {
    debug('Requesting update() remote service on path ' + this.path, id, data, params)
    try {
      const result = await this.requester.send({ type: 'update', id, data, params })
      debug('Successfully update() remote service on path ' + this.path)
      return result
    } catch (error) {
      throw convert(error)
    }
  }
github kalisio / feathers-distributed / src / service.js View on Github external
async remove (id, params) {
    debug('Requesting remove() remote service on path ' + this.path, id, params)
    try {
      const result = await this.requester.send({ type: 'remove', id, params })
      debug('Successfully remove() remote service on path ' + this.path)
      return result
    } catch (error) {
      throw convert(error)
    }
  }
}
github feathersjs / feathers / packages / transport-commons / src / client.ts View on Github external
args.push(function (error: any, data: any) {
        error = convert(error);
        clearTimeout(timeoutId);

        return error ? reject(error) : resolve(data);
      });
github kalisio / feathers-distributed / src / service.js View on Github external
async find (params) {
    debug('Requesting find() remote service on path ' + this.path, params)
    try {
      const result = await this.requester.send({ type: 'find', params })
      debug('Successfully find() remote service on path ' + this.path)
      return result
    } catch (error) {
      throw convert(error)
    }
  }
github kalisio / feathers-distributed / src / service.js View on Github external
async get (id, params) {
    debug('Requesting get() remote service on path ' + this.path, id, params)
    try {
      const result = await this.requester.send({ type: 'get', id, params })
      debug('Successfully get() remote service on path ' + this.path)
      return result
    } catch (error) {
      throw convert(error)
    }
  }
github kalisio / feathers-distributed / src / service.js View on Github external
async patch (id, data, params) {
    debug('Requesting patch() remote service on path ' + this.path, id, data, params)
    try {
      const result = await this.requester.send({ type: 'patch', id, data, params })
      debug('Successfully patch() remote service on path ' + this.path)
      return result
    } catch (error) {
      throw convert(error)
    }
  }
github feathersjs / feathers / packages / rest-client / lib / base.js View on Github external
function toError (error) {
  if (error.code === 'ECONNREFUSED') {
    throw new Unavailable(error.message, _.pick(error, 'address', 'port', 'config'));
  }

  throw convert(error);
}