INNER CODE UNIT · JavaScript

cloudformationCustomResourceMiddlewareOnError

middyjs/middy · packages/cloudformation-response/index.js:69

	const cloudformationCustomResourceMiddlewareOnError = async (request) => {
		request.response = {
			Status: "FAILED",
			Reason: request.error?.message ?? String(request.error),
		};
		await cloudformationCustomResourceMiddlewareAfter(request);
	};
	return {
		after: cloudformationCustomResourceMiddlewareAfter,
		onError: cloudformationCustomResourceMiddlewareOnError,
	};
};

// Only `Reason` is free text, so it is what gets trimmed when the body would
// exceed the cap. The trimmed value is written back so the returned object
// and what CloudFormation received agree.
// Bytes a character occupies in the JSON body: its UTF-8 length, plus the
// escaping JSON.stringify adds for quotes, backslashes and control characters.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…