From 90884d525456e4644723e416424f1581661b2aa8 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 12 Nov 2021 15:43:22 +0300 Subject: Throw correct exception from mark_read API endpoint --- src/main/java/com/juick/www/api/Messages.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/com/juick/www') diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java index 9608813d..a782f680 100644 --- a/src/main/java/com/juick/www/api/Messages.java +++ b/src/main/java/com/juick/www/api/Messages.java @@ -192,7 +192,7 @@ public class Messages { throws IOException { if (!visitor.isAnonymous()) { messagesService.setLastReadComment(visitor, mid, rid); - Message msg = messagesService.getMessage(mid).orElseThrow(IllegalStateException::new); + Message msg = messagesService.getMessage(mid).orElseThrow(HttpNotFoundException::new); userService.updateLastSeen(visitor); applicationEventPublisher.publishEvent(new SystemEvent(this, SystemActivity.read(visitor, msg))); return IOUtils.toByteArray(invisiblePixel.getInputStream()); -- cgit v1.2.3