How to use the @tanker/datastore-base.errors.UnknownError function in @tanker/datastore-base

To help you get started, we’ve selected a few @tanker/datastore-base 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 TankerHQ / sdk-js / packages / datastore / pouchdb-base / src / index.js View on Github external
const previousRecords = await this.find(table, { selector: { _id: { $in: ids } } });
        previousRecords.forEach(rec => {
          idToRev[rec._id] = rec._rev;
        });
        // add missing _rev
        all = all.map(rec => {
          const rev = idToRev[rec._id];
          return rev ? { ...rec, _rev: rev } : rec;
        });
      }
      await this._dbs[table].bulkDocs(toDB(all));
    } catch (e) {
      if (e.status === 409) {
        throw new dbErrors.RecordNotUnique(e);
      }
      throw new dbErrors.UnknownError(e);
    }
  }
github TankerHQ / sdk-js / packages / datastore / dexie-browser / src / index.js View on Github external
get = async (table: string, id: string) => {
    let record;
    try {
      record = fromDB(await this._db.table(table).get(id));
    } catch (e) {
      throw new dbErrors.UnknownError(e);
    }

    // undefined is return when record not found
    if (!record) {
      throw new dbErrors.RecordNotFound();
    }

    return record;
  }

@tanker/datastore-base

Tanker SDK (datastore base)

Apache-2.0
Latest version published 3 months ago

Package Health Score

65 / 100
Full package analysis

Similar packages