Class ResourceRegistryException

java.lang.Object
java.lang.Throwable
java.lang.Exception
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AlreadyPresentException, AvailableInAnotherContextException, ConcurrentWriteException, ContextException, CreationException, InvalidContextNameException, InvalidQueryException, InvalidUUIDException, IsParentOfException, NotFoundException, QueryTemplateException, SchemaException, SchemaViolationException, UUIDAlreadyInUseException

public class ResourceRegistryException extends Exception
Base checked exception for every error condition raised by the Resource Registry REST API. Annotated @JsonTypeInfo so that the concrete subclass name travels on the wire and the original type is restored client-side by ExceptionMapper.

Mapped to 500 Internal Server Error by the REST layer when thrown as this exact class. Every subclass is mapped to a more specific HTTP status by the REST layer's exception mapper (see the subclass Javadoc); a subclass with no explicit mapping defaults to 400 Bad Request.

Author:
Luca Frosini (ISTI - CNR)
See Also:
  • Constructor Details

    • ResourceRegistryException

      public ResourceRegistryException(String message)
      Instantiates a new resource registry exception.
      Parameters:
      message - the message
    • ResourceRegistryException

      public ResourceRegistryException(Throwable cause)
      Instantiates a new resource registry exception.
      Parameters:
      cause - the cause
    • ResourceRegistryException

      public ResourceRegistryException(String message, Throwable cause)
      Instantiates a new resource registry exception.
      Parameters:
      message - the message
      cause - the cause
  • Method Details

    • withResponseMetadata

      public ResourceRegistryException withResponseMetadata(ResponseMetadata metadata)
      Attaches immutable HTTP metadata captured from the failed client request.
      Parameters:
      metadata - response metadata
      Returns:
      this exception
    • getResponseMetadata

      public Optional<ResponseMetadata> getResponseMetadata()
      Returns:
      metadata for the failed HTTP response, when this exception originated in a Java client