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
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 Summary
ConstructorsConstructorDescriptionLambdaMetadataException(String message) Constructs a new exception with the specified message.LambdaMetadataException(String message, int statusCode) Constructs a new exception with the specified message and HTTP status code.LambdaMetadataException(String message, Throwable cause) Constructs a new exception with the specified message and cause. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the HTTP status code from the metadata endpoint.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
LambdaMetadataException
Constructs a new exception with the specified message.- Parameters:
message- the error message
-
LambdaMetadataException
Constructs a new exception with the specified message and cause.- Parameters:
message- the error messagecause- the underlying cause
-
LambdaMetadataException
Constructs a new exception with the specified message and HTTP status code.- Parameters:
message- the error messagestatusCode- 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
-