Propagate errors that were silently swallowed across services and frontend - #17
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Propagate errors that were silently swallowed across services and frontend#17devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit of error handling across the services + frontend. Several failures were being turned into apparent success, which is worse than a loud failure because Camunda/BPMN and the user both keep going as if nothing happened. This PR fixes the cases where the failure was actually lost, and adds the exception object (or a log line) everywhere a failure was intentionally tolerated but invisible.
Failures that were reported as success
BankWorker—unlockMoney/chargeMoneyBlocklogged the rejected bank response andreturned, so the Zeebe job auto-completed and the process moved on as if the money had been unlocked/charged (blockMoneyalready failed the process properly):ProcessSessionWorker.deleteProcessSession— swallowed the exception, so an undeleted session still completed the job; now rethrown after logging (Zeebe retries → incident).FleetSimulator—sendStepended with.exceptionally(ex -> { log; return null; }), which completes the future successfully. Consequence:POST /monitoring/startreturned200 RENTEDand thestartMonitoringworker considered monitoring active even when both gRPC calls failed, and the vehicle stayed inactiveSimulationsforever. Same pattern hidstopTracking/stopMonitoringfailures on/monitoring/stop.exceptionally→whenComplete(logs, keeps the failure in the future);registerNewRentalalso drops the simulation it just registered when the first step fails. The scheduled tick keeps its per-vehicle isolation but now logs the async step failure instead of discarding the future.HttpRentalServiceCallbackClient— a failedVEHICLE_RECHARGEDcallback was caught and logged, so the async recharge finished "successfully" while the rental process waited for a message that would never arrive. It now throwsStationOperationException, andStationsService.completeRechargeretries the callback (3 attempts, 500 ms apart) before letting the async future fail — logged with the exception via.exceptionally(...)on theCompletableFuture(the publicrechargeVehicleresponse stays "recharge started" by design).bank.ol—resposnse.errorStatus = "INSUFFICIENT_FUNDS"typo meant the insufficient-funds rejection never carried anerrorStatus, soBankWorkerloggednullfor the one error status that matters.Failures that were logged but stripped of detail
MonitoringControllerhadlog.error("... {}", vehicleId, e.getMessage())in all three.exceptionally(...)handlers: with one placeholder and aString(notThrowable) as the extra argument, SLF4J drops the argument entirely — the cause was never printed. Now passese. Same treatment forFleetManagementWorker,FleetSimulator's tick,GraphHopperClient(fallback behaviour unchanged),ZeebeDeploymentConfigandSseRedisSubscriber(also narrowed toJsonProcessingExceptionand now logs dropped emitters).FleetManagementWorker.monitoringLogicadditionally guards thenewFailCommand(...)call itself, so a failure while reporting a failure isn't swallowed.Domain rejection vs unexpected failure (rental-service)
scanQr/bookByType/undoBookingcaughtRuntimeExceptionand returnedsuccess=false, message=<any exception message>, so a DB outage or NPE was presented to the user as an ordinary business rejection. Domain rejections now use a dedicatedRentalOperationExceptionand only that is converted to a failure DTO; anything else propagates.IllegalArgumentException(e.g. a non-numericvehicleIdinGET /rentals/booking) is mapped to400inProcessExceptionHandlerinstead of surfacing as a 500.Frontend
catchError(() => EMPTY)in the resume polling ofProcessNavigationServicediscarded every failure with no trace; the retry semantics are kept but each failed attempt is logged through askipFailedPoll(operation, error)helper. InProcessEventServicethe reconciliationcatchErrormoved insideswitchMap— an error there previously killed the subscription for all subsequentnavigation-state-changedevents — plus logging for malformed SSE payloads andEventSourceerrors.SessionService(bootstrap + logout) andrideCompletionGuardkeep their fallback behaviour but log why.Tests
New:
BankWorkerTest,ProcessSessionWorkerTest, failure cases inFleetSimulatorTest(registerNewRental/unregisterRentalpropagate and don't leak state),HttpRentalServiceCallbackClientTest.failedCallbackIsReportedToTheCaller,StationsServiceTest.rechargeCallbackIsRetriedBeforeGivingUp.mvn testgreen for rental-service, stations-service, fm-gateway;ng buildclean.ng testhas 2 failures (rideCompletionGuard redirects…,ActiveRideComponent opens the transient summary…) that reproduce identically onmain— pre-existing, untouched here.Link to Devin session: https://app.devin.ai/sessions/11592aa2fba14aebb7839320f456a2db
Requested by: @NicolasCola7