Access to 'result' in expectError() validator
frauss opened this issue · 1 comments
frauss commented
Is it possible to get access to the result in the validator function passed to expectError() when a Lambda function invokes the callback with an error AND a result?
For example when I have something like this in my Lambda handler:
if (err) {
let errorMessage = util.format("Error verifying Authorization token:\n%s", err);
console.error(errorMessage);
let principalId = "unknown";
authenticatorResponse = generatePolicy(principalId, 'Deny', event.methodArn);
authenticatorResponse.context = {
"tokenExpired": (err.name === "TokenExpiredError").toString(),
"decodeError": errorMessage
};
lambdaCallback(err, authenticatorResponse);
}
It would be useful to give the validator access to what is in the result passed to the callback.
frauss commented
Never mind, realized the parameter is ignored when an error is returned as the 1st callback parameter.