diff --git a/cypress/e2e/sub-routes.spec.js b/cypress/e2e/sub-routes.spec.js index ecc1c81cd0..e507e009e9 100644 --- a/cypress/e2e/sub-routes.spec.js +++ b/cypress/e2e/sub-routes.spec.js @@ -56,7 +56,7 @@ for (const port of Cypress.env("ports")) { cy.contains("SyntaxError"); cy.expectMainContents([ ...fixedContents, - 'SyntaxError: Unexpected token (1:4), in "<% CTX. %>"', + 'Oops! Something went wrong: SyntaxError: Unexpected token (1:4), in "<% CTX. %>"', ]); cy.get("@console.error").should("be.called"); diff --git a/packages/brick-container/serve/middlewares/standaloneBootstrapJson.js b/packages/brick-container/serve/middlewares/standaloneBootstrapJson.js index c9c4f98760..fade604101 100644 --- a/packages/brick-container/serve/middlewares/standaloneBootstrapJson.js +++ b/packages/brick-container/serve/middlewares/standaloneBootstrapJson.js @@ -44,6 +44,7 @@ function getE2eSettings() { presetBricks: { notification: false, dialog: false, + error: false, }, }; } diff --git a/packages/brick-container/src/BootstrapError.shadow.css b/packages/brick-container/src/BootstrapError.shadow.css new file mode 100644 index 0000000000..fea9c06149 --- /dev/null +++ b/packages/brick-container/src/BootstrapError.shadow.css @@ -0,0 +1,33 @@ +:host { + display: flex; + flex-direction: column; + align-items: center; + padding: 48px 32px; +} + +:host([hidden]) { + display: none; +} + +.icon { + color: var(--color-error); + font-size: 72px; + margin-bottom: 24px; +} + +.icon svg { + display: block; +} + +.title { + color: var(--antd-heading-color); + font-size: 24px; + line-height: 1.8; +} + +.description { + color: var(--antd-text-color-secondary); + font-size: 14px; + line-height: 1.6; + text-align: center; +} diff --git a/packages/brick-container/src/BootstrapError.ts b/packages/brick-container/src/BootstrapError.ts new file mode 100644 index 0000000000..aef7590f3e --- /dev/null +++ b/packages/brick-container/src/BootstrapError.ts @@ -0,0 +1,19 @@ +// istanbul ignore file +import styleText from "./BootstrapError.shadow.css"; + +const icon = ``; + +export class BootstrapError extends HTMLElement { + connectedCallback() { + if (this.shadowRoot) { + return; + } + const shadowRoot = this.attachShadow({ mode: "open" }); + shadowRoot.innerHTML = [ + ``, + `