Add displaying the reason for an error while reason turned to inactive

Description

While approval of batch order on UI error 'There was an error with this request, please contact the server administrator' was shown like in this ticket
https://openlmis.atlassian.net/browse/MALAWISUP-3066

During investigation of problem turned out that before batch order approval reason turned to inactive.
In logs was:

o.o.r.errorhandling.GlobalErrorHandling : An external api error occurred org.openlmis.requisition.exception.ExternalApiException: LocalizedMessageDto(messageKey=stockmanagement.error.physicalInventory.lineItems.stockAdjustments.reason.notValid, message=Cannot save stock information: the reason e582cad3-8b63-4606-91c6-97b4a090889a is not active for program 67ea48e9-8a39-470d-82a1-c74007876605 and facility type edbe8a0e-4c33-43ab-a964-2ad4f424071b. Update your data to use an active reason and try again.) at org.openlmis.requisition.service.stockmanagement.StockEventStockManagementService.submit(StockEventStockManagementService.java:73) at org.openlmis.requisition.web.BaseRequisitionController.submitStockEvent(BaseRequisitionController.java:435) at org.openlmis.requisition.web.BatchRequisitionController.lambda$submitStockEvent$4(BatchRequisitionController.java:434) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.web.client.HttpClientErrorException$BadRequest: 400 : [{ "messageKey" : "stockmanagement.error.physicalInventory.lineItems.stockAdjustments.reason.notValid", "message" : "Cannot save stock information: the reason e582cad3-8b63-4606-91c6-97b4a090889a is not active for program 67ea48e9-8a39-470d-82a1-c74007876605 and facility type edbe8a0e-4c33-43ab-a964-2ad4f424071b. Update your data to use an active reason and try again." }] at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:101) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:170) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:112) at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:785) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:743) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:717) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:605) at org.openlmis.requisition.service.stockmanagement.StockEventStockManagementService.lambda$submit$0(StockEventStockManagementService.java:60) at org.openlmis.requisition.service.BaseCommunicationService.runWithTokenRetry(BaseCommunicationService.java:293) at org.openlmis.requisition.service.BaseCommunicationService.runWithRetryAndTokenRetry(BaseCommunicationService.java:314) at org.openlmis.requisition.service.stockmanagement.StockEventStockManagementService.submit(StockEventStockManagementService.java:59) ... 6 common frames omitted

Real couse of problem should be shown.

Activity

Show:
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Priority

Time Assistant

Created August 18, 2021 at 1:19 PM
Updated February 8, 2023 at 1:30 PM

Flag notifications