Improved exceptions handling<

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@141784 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-01-25 15:38:50 +00:00
parent 214e3ec5b7
commit ca2814c7d3
4 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,9 @@
<ReleaseNotes>
<Changeset component="org.gcube.portal.social-networking-library.1-15-0"
date="2017-01-25">
<Change>Added support for job completion notifications</Change>
<Change>Improved exceptions handling</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-networking-library.1-14-0"
date="2016-09-29">
<Change>upgrade astyanax dependency to 2.0.2</Change>

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>1.14.0-SNAPSHOT</version>
<version>1.15.0-SNAPSHOT</version>
<name>gCube Social Networking Library</name>
<description>
The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities.

View File

@ -442,7 +442,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
try {
toCheck = readFeed(feedId);
if (toCheck == null)
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId);
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId, feedId);
} catch (Exception e) {
e.printStackTrace();
return false;
@ -470,7 +470,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
ColumnList<String> columns = result.getResult();
if (columns.size() == 0) {
throw new FeedIDNotFoundException("The requested feedid: " + feedid + " is not existing");
throw new FeedIDNotFoundException("The requested feedid: " + feedid + " is not existing", feedid);
}
toReturn.setKey(feedid);
@ -1344,7 +1344,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
try {
toComment = readFeed(feedId);
if (toComment == null)
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId + " to associate this comment");
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId + " to associate this comment", feedId);
} catch (Exception e) {
e.printStackTrace();
return false;
@ -1615,7 +1615,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
try {
toLike = readFeed(feedId);
if (toLike == null)
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId + " to associate this like");
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId + " to associate this like", feedId);
} catch (Exception e) {
e.printStackTrace();
return false;
@ -2160,7 +2160,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
try {
toCheck = readFeed(feedId);
if (toCheck == null)
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId);
throw new FeedIDNotFoundException("Could not find Feed with id " + feedId, feedId);
} catch (Exception e) {
e.printStackTrace();
return null;

View File

@ -1,8 +1,13 @@
package org.gcube.portal.databook.shared.ex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("serial")
public class FeedIDNotFoundException extends Exception {
public FeedIDNotFoundException(String message) {
super(message);
private static final Logger _log = LoggerFactory.getLogger(FeedIDNotFoundException.class);
public FeedIDNotFoundException(String message, String postId) {
_log.info("The Post having id: " + postId + " is not present in the database: " + message);
}
}