From f174dbf8fd5e8a675f581fecae7cc2480be2ad40 Mon Sep 17 00:00:00 2001 From: Gethin Webster Date: Wed, 8 Jul 2026 08:41:23 +0000 Subject: [PATCH] feat: log app layout error-boundary catches with a fixed prefix Emit a fixed [AwsUiAppLayoutError] prefix from the app layout error boundary's onError so integration/canary tests can detect real App Layout breakage by matching the prefix instead of maintaining an allowlist of unrelated console noise. The prefix is a string literal, so it survives minification. --- .../__tests__/widget-areas-error-boundaries.test.tsx | 5 +++++ src/error-boundary/internal.tsx | 1 + 2 files changed, 6 insertions(+) diff --git a/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx b/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx index c82dd1cbcb..f0991f98b4 100644 --- a/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx +++ b/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx @@ -87,6 +87,7 @@ describe('AppLayout error boundaries: errors in different areas does not crash t (wrappedWithErrorBoundary: boolean) => { const onError = jest.fn(); const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => {}); const AppLayoutWrapper = wrappedWithErrorBoundary ? ErrorBoundary : 'div'; const appLayoutWrapperProps = wrappedWithErrorBoundary ? { onError } : {}; const content =
content
; @@ -104,6 +105,10 @@ describe('AppLayout error boundaries: errors in different areas does not crash t appLayoutPart, errorMessage: expect.any(String), }); + expect(consoleLogSpy).toHaveBeenCalledWith( + `[AwsUiAppLayoutError] appLayoutPart=${appLayoutPart}`, + expect.anything() + ); } const reportedParts = sendPanoramaMetricSpy.mock.calls .filter(call => call[0] === 'awsui-app-layout-error-boundary-fired') diff --git a/src/error-boundary/internal.tsx b/src/error-boundary/internal.tsx index b629723ae6..09f74c70a4 100644 --- a/src/error-boundary/internal.tsx +++ b/src/error-boundary/internal.tsx @@ -110,6 +110,7 @@ export function AppLayoutBuiltInErrorBoundary({ errorMessage: error?.error?.message ?? '', appLayoutPart: appLayoutPart ?? '', }); + console.log(`[AwsUiAppLayoutError] appLayoutPart=${appLayoutPart ?? ''}`, error?.error); }} >