added status and error message on Exceptions
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/storagehub-model@178695 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d0162a75f4
commit
789d1be20e
|
@ -15,16 +15,19 @@
|
|||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
|
|
13
.project
13
.project
|
@ -5,11 +5,21 @@
|
|||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
|
@ -17,7 +27,10 @@
|
|||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="storagehub-model_TRUNK">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1,2 @@
|
|||
disabled=06target
|
||||
eclipse.preferences.version=1
|
|
@ -26,5 +26,15 @@ public class BackendGenericError extends StorageHubException{
|
|||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "generic error in the backend";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,14 @@ public class IdNotFoundException extends StorageHubException {
|
|||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "item not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 404;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,4 +27,14 @@ public class InvalidCallParameters extends StorageHubException {
|
|||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "invalid call parameter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 400;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,14 @@ public class InvalidItemException extends StorageHubException {
|
|||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "invalid item in request";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,4 +27,13 @@ public class ItemAlreadyExistsException extends StorageHubException {
|
|||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "item already exists";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
public class ItemLockedException extends StorageHubException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ItemLockedException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ItemLockedException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ItemLockedException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ItemLockedException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "item locked";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 409;
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,10 @@ public abstract class StorageHubException extends Exception {
|
|||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public abstract String getErrorMessage();
|
||||
|
||||
public abstract int getStatus();
|
||||
|
||||
public StorageHubException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
|
|
|
@ -27,5 +27,14 @@ public class UserNotAuthorizedException extends StorageHubException {
|
|||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "user not authorized";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 401;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue