From ab621e9c5fb9b6ec558fc46dd8c9a45f8ff1dd4a Mon Sep 17 00:00:00 2001 From: Risto Kankkunen Date: Mon, 20 May 2013 22:33:45 +0300 Subject: [PATCH] Make the error message prettier by avoiding a nested exception. --HG-- extra : rebase_source : 8c33ce8a8a6ae92fcc1e46a7b416e1c9802bf726 --- .../backend/services/FeedSubscriptionService.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/commafeed/backend/services/FeedSubscriptionService.java b/src/main/java/com/commafeed/backend/services/FeedSubscriptionService.java index 54c342f7..566368c2 100644 --- a/src/main/java/com/commafeed/backend/services/FeedSubscriptionService.java +++ b/src/main/java/com/commafeed/backend/services/FeedSubscriptionService.java @@ -3,6 +3,7 @@ package com.commafeed.backend.services; import java.util.List; import javax.ejb.Stateless; +import javax.ejb.ApplicationException; import javax.inject.Inject; import com.commafeed.backend.dao.FeedEntryDAO; @@ -19,6 +20,12 @@ import com.google.api.client.util.Lists; @Stateless public class FeedSubscriptionService { + @ApplicationException + public class FeedSubscriptionException extends RuntimeException { + public FeedSubscriptionException(String msg) { + super(msg); + } + } @Inject FeedService feedService; @@ -43,7 +50,8 @@ public class FeedSubscriptionService { final String pubUrl = applicationSettingsService.get().getPublicUrl(); if (pubUrl == null) { - throw new RuntimeException("Public URL of this CommaFeed is unset"); + throw new FeedSubscriptionException( + "Public URL of this CommaFeed is unset"); } if (url.startsWith(pubUrl)) { throw new RuntimeException(