36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package org.gcube.resourcemanagement.manager.io.codeexceptions;
|
|
|
|
import javax.ws.rs.WebApplicationException;
|
|
import javax.ws.rs.core.Response;
|
|
|
|
/**
|
|
* Exception returned by the Resource Manager.
|
|
*
|
|
* @author Manuele Simi (ISTI CNR)
|
|
*
|
|
*/
|
|
public class WebCodeException extends WebApplicationException {
|
|
|
|
private static final long serialVersionUID = 333945715086602250L;
|
|
|
|
public WebCodeException() {
|
|
super(Response.status(Response.Status.NOT_ACCEPTABLE).build());
|
|
}
|
|
public WebCodeException(Response.Status status, ErrorCode code) {
|
|
super(Response.status(status).entity(new CodeEntity(new SerializableErrorEntity(code)))
|
|
.build());
|
|
}
|
|
|
|
public WebCodeException(ErrorCode code) {
|
|
super(Response.status(Response.Status.NOT_ACCEPTABLE)
|
|
.entity(new CodeEntity(new SerializableErrorEntity(code))).build());
|
|
}
|
|
|
|
public <E extends Exception> WebCodeException(E exception) {
|
|
//super(Response.status(Response.Status.NOT_ACCEPTABLE)
|
|
// .entity(new CodeEntity(new SerializableErrorEntity(exception))).build());
|
|
super(Response.status(Response.Status.NOT_ACCEPTABLE)
|
|
.entity(new CodeEntity(new SerializableErrorEntity(exception))).build());
|
|
}
|
|
}
|