Skip to content

Commit

Permalink
Merge pull request #45 from target/PNA-2105
Browse files Browse the repository at this point in the history
Handling Error Stream Exceptions
  • Loading branch information
bmcecilia3 authored Jul 30, 2024
2 parents 8551ba0 + cb86c62 commit 3bf76d4
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,17 @@ public DeviceAvailabilityResponse getDeviceAvailability() {
@GetMapping("/v1/deviceerror")
public SseEmitter getDeviceError() throws IOException {
LOGGER.info("GET : /v1/deviceerror");
SseEmitter sseEmitter = new SseEmitter(Long.MAX_VALUE);
deviceAvailabilityService.subscribeToDeviceError(sseEmitter);
return sseEmitter;
try {
SseEmitter sseEmitter = new SseEmitter(Long.MAX_VALUE);
deviceAvailabilityService.subscribeToDeviceError(sseEmitter);
return sseEmitter;
} catch (IOException ioException) {
LOGGER.info("IOException in DeviceError: " + ioException.getMessage());
throw ioException;
} catch (Exception exception) {
LOGGER.info("Exception in DeviceError: " + exception.getMessage());
throw exception;
}
}

@Operation(description = "Health status of all devices")
Expand Down

0 comments on commit 3bf76d4

Please sign in to comment.