How to use the elasticsearch.errors.Conflict function in elasticsearch

To help you get started, we’ve selected a few elasticsearch 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 elastic / kibana / src / plugins / kibana / server / lib / __tests__ / handle_es_error.js View on Github external
it('should transform elasticsearch errors into boom errors with the same status code', function () {
    var conflict = handleESError(new esErrors.Conflict());
    expect(conflict.isBoom).to.be(true);
    expect(conflict.output.statusCode).to.be(409);

    var forbidden = handleESError(new esErrors[403]);
    expect(forbidden.isBoom).to.be(true);
    expect(forbidden.output.statusCode).to.be(403);

    var notFound = handleESError(new esErrors.NotFound());
    expect(notFound.isBoom).to.be(true);
    expect(notFound.output.statusCode).to.be(404);

    var badRequest = handleESError(new esErrors.BadRequest());
    expect(badRequest.isBoom).to.be(true);
    expect(badRequest.output.statusCode).to.be(400);
  });
github elastic / kibana / src / server / saved_objects / client / lib / __tests__ / decorate_es_error.js View on Github external
it('makes es.Conflict a SavedObjectsClient/Conflict error', () => {
    const error = new esErrors.Conflict();
    expect(isConflictError(error)).to.be(false);
    expect(decorateEsError(error)).to.be(error);
    expect(isConflictError(error)).to.be(true);
  });
github elastic / kibana / src / legacy / core_plugins / elasticsearch / lib / __tests__ / handle_es_error.js View on Github external
it('should transform elasticsearch errors into boom errors with the same status code', function () {
    const conflict = handleESError(new esErrors.Conflict());
    expect(conflict.isBoom).to.be(true);
    expect(conflict.output.statusCode).to.be(409);

    const forbidden = handleESError(new esErrors[403]);
    expect(forbidden.isBoom).to.be(true);
    expect(forbidden.output.statusCode).to.be(403);

    const notFound = handleESError(new esErrors.NotFound());
    expect(notFound.isBoom).to.be(true);
    expect(notFound.output.statusCode).to.be(404);

    const badRequest = handleESError(new esErrors.BadRequest());
    expect(badRequest.isBoom).to.be(true);
    expect(badRequest.output.statusCode).to.be(400);
  });
github elastic / kibana / src / core_plugins / kibana / server / lib / __tests__ / handle_es_error.js View on Github external
it('should transform elasticsearch errors into boom errors with the same status code', function () {
    const conflict = handleESError(new esErrors.Conflict());
    expect(conflict.isBoom).to.be(true);
    expect(conflict.output.statusCode).to.be(409);

    const forbidden = handleESError(new esErrors[403]);
    expect(forbidden.isBoom).to.be(true);
    expect(forbidden.output.statusCode).to.be(403);

    const notFound = handleESError(new esErrors.NotFound());
    expect(notFound.isBoom).to.be(true);
    expect(notFound.output.statusCode).to.be(404);

    const badRequest = handleESError(new esErrors.BadRequest());
    expect(badRequest.isBoom).to.be(true);
    expect(badRequest.output.statusCode).to.be(400);
  });