Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On client error throw, catch and handle exception #38

Open
wants to merge 7 commits into
base: feature/TAO-10203-advanced-search
Choose a base branch
from

Conversation

bartlomiejmarszal
Copy link
Contributor

Regarding issue below:

https://oat-sa.atlassian.net/l/c/Zxcvk6W2

I'm introducing ES client operation in try-catch blocks in order to handle errors that may appear from the client.

Copy link
Contributor

@shpran shpran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some minor comments.
Good job!

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

src/ElasticSearchIndexer.php Outdated Show resolved Hide resolved
src/ElasticSearchIndexer.php Outdated Show resolved Hide resolved
src/ElasticSearch.php Outdated Show resolved Hide resolved
Copy link
Contributor

@gabrielfs7 gabrielfs7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things to check

src/ElasticSearch.php Outdated Show resolved Hide resolved
@bartlomiejmarszal
Copy link
Contributor Author

This PR is depending to oat-sa/tao-core#2724

Copy link
Contributor

@gabrielfs7 gabrielfs7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add unit tests?

Separate errors with semicolon.
$this->sut->buildIndex($iterator);
}

private function getMultipleDocs(MockObject $doc, $quantity)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approved the PR, but we could avoid that by making the INDEXING_BLOCK_SIZE injectable / customizable, so yuo do not need to iterate 100 results to test. I think this test will be slow at some point if we do not do it.

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move the private method as the last? It is in our CR guideline

->method('bulk')
->willReturn([
'errors' => true,
'items' => [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about the structure of the $clientResponse['items'] ?


foreach ($clientResponse['items'] as $response) {
$response = reset($response);
$errors .= $response['error']['reason'] . '; ';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we using this reason inside FE , did we communicate with them about the glue used?


foreach ($clientResponse['items'] as $response) {
$response = reset($response);
$errors .= $response['error']['reason'] . '; ';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed , let's add a identifier to the processed data so we are able to identify the failing items
also let's check what items are failing

Copy link
Contributor

@shpran shpran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 👍🏻

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants