com.networknt.aws.lambda.exception.LambdaExchangeStateException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda-native Show documentation
Show all versions of lambda-native Show documentation
A middleware Lambda function that handles all the cross-cutting concerns for the downstream Lambda function.
The newest version!
package com.networknt.aws.lambda.exception;
public class LambdaExchangeStateException extends RuntimeException {
public LambdaExchangeStateException(String message) {
super(message);
}
public static LambdaExchangeStateException invalidStateException(int state, int wrongState) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
var stateString = Integer.toBinaryString(state);
var wrongStateString = Integer.toBinaryString(wrongState);
return new LambdaExchangeStateException("Attempted to execute '" + stackTraceElements[2].getMethodName() + "' while in the wrong state. Current state '" + stateString + "' has flag state '" + wrongStateString + "'.");
}
public static LambdaExchangeStateException missingStateException(int state, int missing) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
var stateString = Integer.toBinaryString(state);
var missingStateString = Integer.toBinaryString(missing);
return new LambdaExchangeStateException("Attempted to execute '" + stackTraceElements[2].getMethodName() + "' while missing a flag. Current state '" + stateString + "' is missing flag state '" + missingStateString + "'.");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy