Skip to content

Commit

Permalink
Merge pull request #64 from europeana/EA-3842-exception-handling-and_…
Browse files Browse the repository at this point in the history
…logging

need to get service ID before calling the translation for error logging
  • Loading branch information
gsergiu authored Jun 14, 2024
2 parents f63d736 + 9c3a1b9 commit d78543c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ public TranslationResponse translate(TranslationRequest translationRequest)
String serviceId = null;
for (TranslationService cachedTranslationService : cachedTranslationServices) {
try {
serviceId = cachedTranslationService.getServiceId();
// send the values which are not yet translated (isTranslated=false) for the translations
cachedTranslationService.translate(translObjs.stream().filter(to -> !to.isTranslated()).collect(Collectors.toList()));
// call this method after the translate() method, because the serviceId changes depending if
// there is sth in the cache
// update service ID after the translate() method, because the serviceId may change (depending if there is sth in the cache)
//NOTE: is this really needed?
serviceId = cachedTranslationService.getServiceId();
// clear translation error if the invocation is successfull
translationError = null;
Expand Down

0 comments on commit d78543c

Please sign in to comment.