display error messages

This commit is contained in:
Athou
2013-03-31 18:47:17 +02:00
parent a9e5c50b3f
commit 5994369e01
8 changed files with 34 additions and 6 deletions

View File

@@ -56,6 +56,7 @@ public class EntriesREST extends AbstractREST {
getUser(), Long.valueOf(id));
if (subscription != null) {
entries.setName(subscription.getTitle());
entries.setMessage(subscription.getFeed().getMessage());
entries.getEntries().addAll(
buildEntries(subscription, offset, limit, unreadOnly));
}

View File

@@ -53,7 +53,15 @@ public class SubscriptionsREST extends AbstractREST {
Preconditions.checkNotNull(req.getTitle());
Preconditions.checkNotNull(req.getUrl());
Feed feed = feedService.findByUrl(req.getUrl());
Feed fetchedFeed = null;
try {
fetchedFeed = feedFetcher.fetch(req.getUrl());
} catch (FeedException e) {
return Response.status(Status.NOT_FOUND).entity(e.getMessage())
.build();
}
Feed feed = feedService.findByUrl(fetchedFeed.getUrl());
if (feed == null) {
feed = new Feed();
feed.setUrl(req.getUrl());