-
Notifications
You must be signed in to change notification settings - Fork 35
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
Create try-catch block for index
method
#2724
base: feature/TAO-10203-advanced-search
Are you sure you want to change the base?
Create try-catch block for index
method
#2724
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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
try { | ||
$numberOfIndexed = $searchService->index([$indexDocument]); | ||
} catch (Exception $exception) { | ||
return new Report(Report::TYPE_ERROR, $exception->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use static method:
return new Report(Report::TYPE_ERROR, $exception->getMessage()); | |
return Report::createFailure($exception->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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
$numberOfIndexed = $searchService->index([$indexDocument]); | ||
try { | ||
$numberOfIndexed = $searchService->index([$indexDocument]); | ||
} catch (Exception $exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT?
} catch (Exception $exception) { | |
} catch (Throwable $exception) { |
Cause we are now throwing an error on indexing (refer to this PR)
I included try-catch when calling index method
https://oat-sa.atlassian.net/browse/CON-23