Class LambdaMetadataException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
software.amazon.lambda.powertools.metadata.exception.LambdaMetadataException
All Implemented Interfaces:
Serializable

public class LambdaMetadataException extends RuntimeException
Exception thrown when the Lambda Metadata Endpoint is unavailable or returns an error.

This exception may be thrown when:

  • The metadata endpoint environment variables are not set
  • The metadata endpoint returns a non-200 status code
  • Network errors occur when connecting to the endpoint
  • The response cannot be parsed

See Also:
  • Constructor Details

    • LambdaMetadataException

      public LambdaMetadataException(String message)
      Constructs a new exception with the specified message.
      Parameters:
      message - the error message
    • LambdaMetadataException

      public LambdaMetadataException(String message, Throwable cause)
      Constructs a new exception with the specified message and cause.
      Parameters:
      message - the error message
      cause - the underlying cause
    • LambdaMetadataException

      public LambdaMetadataException(String message, int statusCode)
      Constructs a new exception with the specified message and HTTP status code.
      Parameters:
      message - the error message
      statusCode - the HTTP status code from the metadata endpoint
  • Method Details

    • getStatusCode

      public int getStatusCode()
      Returns the HTTP status code from the metadata endpoint.
      Returns:
      the HTTP status code, or -1 if not applicable