diff --git a/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java b/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java index 43b5c88a46..1571901e72 100644 --- a/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java +++ b/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java @@ -153,6 +153,7 @@ public Result uploadDocument(IPatient patient, File document, Stri new UploadResult(appendPath(getBrowserBasePath(), data.getUrl() + "&mode=embed"), data.getId(), resulttyp, uploadedMediplan)); } catch (ApiException e) { + hinAuthHandleException(e); if (e.getCode() == 400 || e.getCode() == 422) { // error result code should be evaluated try { @@ -172,6 +173,16 @@ public Result uploadDocument(IPatient patient, File document, Stri } } + private void hinAuthHandleException(ApiException e) { + if (hinAuthService.isPresent()) { + Optional message = hinAuthService.get().handleException(e, + Collections.singletonMap(IHinAuthService.TOKEN_GROUP, getTokenGroup())); + if (message.isPresent()) { + logger.warn("HIN Auth message", message.get()); + } + } + } + private void configureApiClient(ApiClient client) { client.setBasePath(getAppBasePath()); if(hinAuthService.isPresent()) { @@ -249,6 +260,7 @@ public Result uploadCheck(IPatient patient) { return new Result(SEVERITY.ERROR, 0, "No active mandator", null, false); } } catch (ApiException e) { + hinAuthHandleException(e); if (e.getCode() == 400 || e.getCode() == 422) { // error result code should be evaluated try { @@ -286,6 +298,7 @@ public Result emediplanNotification(IPatient patient) { DateTimeFormatter.ofPattern("dd.MM.yyyy").format(birthDate)); return Result.OK(response.toString()); } catch (ApiException e) { + hinAuthHandleException(e); if (e.getCode() == 400 || e.getCode() == 422) { // error result code should be evaluated try { @@ -388,6 +401,7 @@ public Result downloadEMediplan(UploadResult uploadResult) { return Result.OK(response.getData()); } } catch (ApiException e) { + hinAuthHandleException(e); logger.error("Error downloading Document", e); return Result.ERROR(e.getMessage()); } @@ -408,6 +422,7 @@ public Result downloadPdf(UploadResult uploadResult) { } return Result.OK(response.getData().getAbsolutePath()); } catch (ApiException e) { + hinAuthHandleException(e); logger.error("Error downloading Document Pdf", e); return Result.ERROR(e.getMessage()); }