Class SerializableErrorEntity

java.lang.Object
org.gcube.common.gxrest.response.entity.SerializableErrorEntity

public class SerializableErrorEntity extends Object
An entity that can be serialized in a WebCodeException.
Author:
Manuele Simi (ISTI CNR), Luca Frosini (ISTI-CNR)
  • Field Details

    • ENTITY_CHAR_SEPARATOR

      protected static final char ENTITY_CHAR_SEPARATOR
      The separator for the entity fields.
      See Also:
  • Constructor Details

    • SerializableErrorEntity

      public SerializableErrorEntity()
      Creates a new serializable error entity.
    • SerializableErrorEntity

      public SerializableErrorEntity(ErrorCode errorCode)
      Parameters:
      errorCode - the errorc code to serialize
    • SerializableErrorEntity

      public SerializableErrorEntity(Exception e)
      Parameters:
      e - the exception to serialize
    • SerializableErrorEntity

      public SerializableErrorEntity(Exception e, int lines)
      Parameters:
      e - the exception to serialize
      lines - the number of lines in the stacktrace to serialize
  • Method Details

    • getId

      public int getId()
      Gets the id of the error.
      Returns:
      the id
    • getMessage

      public String getMessage()
      Gets the message of the error.
      Returns:
      the message
    • getExceptionClass

      public String getExceptionClass()
      Returns:
      the full qualified name of the embedded Exception
    • getEncodedTrace

      public String getEncodedTrace()
      Returns:
      the encoded stacktrace
    • hasStackTrace

      public boolean hasStackTrace()
      Checks if a stacktrace is available.
      Returns:
      true if a stacktrace is serialized in the entity.
    • setMessage

      protected void setMessage(String message)
      Sets the message.
      Parameters:
      message - the message
    • setExceptionClass

      protected void setExceptionClass(String exceptionClass)
      Sets the exception class.
      Parameters:
      exceptionClass - the exception class
    • setEncodedTrace

      protected void setEncodedTrace(String encodedTrace)
      Sets the enconded trace.
      Parameters:
      encodedTrace - the encoded trace