resource-manager/io/src/main/java/org/gcube/resourcemanagement/manager/io/codeexceptions/SerializableErrorEntity.java

52 lines
940 B
Java

package org.gcube.resourcemanagement.manager.io.codeexceptions;
/**
* An entity that can be serialized in a {@link WebCodeException}.
*
* @author Manuele Simi (ISTI CNR)
*
*/
public class SerializableErrorEntity {
private int id = -1;
private String message;
private String exceptionClass;
public SerializableErrorEntity() {}
/**
* @param id
* @param message
*/
public SerializableErrorEntity(ErrorCode errorCode) {
this.id = errorCode.getId();
this.message = errorCode.getMessage();
}
/**
*
* @param e
*/
public SerializableErrorEntity(Exception e) {
this.exceptionClass = e.getClass().getCanonicalName();
this.message = e.getMessage();
}
public int getId() {
return this.id;
}
public String getMessage() {
return this.message;
}
/**
* @return the full qualified name of the embedded {@link Exception}
*/
public String getExceptionClass() {
return this.exceptionClass;
}
}