feat(error-handling): introduce unified and configurable error handling (#7761)

Refs #7778
This commit is contained in:
Vladimir Gorej
2022-01-24 16:12:13 +01:00
committed by GitHub
parent 4f2287fe53
commit 8b1c4a7c1a
19 changed files with 629 additions and 295 deletions

View File

@@ -1,6 +1,7 @@
import StandaloneLayout from "./layout"
import TopbarPlugin from "plugins/topbar"
import ConfigsPlugin from "corePlugins/configs"
import SafeRenderPlugin from "core/plugins/safe-render"
// the Standalone preset
@@ -11,5 +12,13 @@ export default [
return {
components: { StandaloneLayout }
}
}
},
SafeRenderPlugin({
fullOverride: true,
componentList: [
"Topbar",
"StandaloneLayout",
"onlineValidatorBadge"
]
})
]

View File

@@ -21,22 +21,16 @@ export default class StandaloneLayout extends React.Component {
const Topbar = getComponent("Topbar", true)
const BaseLayout = getComponent("BaseLayout", true)
const OnlineValidatorBadge = getComponent("onlineValidatorBadge", true)
const ErrorBoundary = getComponent("ErrorBoundary", true)
return (
<Container className='swagger-ui'>
<ErrorBoundary targetName="Topbar">
{Topbar ? <Topbar /> : null}
</ErrorBoundary>
{Topbar ? <Topbar /> : null}
<BaseLayout />
<ErrorBoundary targetName="OnlineValidatorBadge">
<Row>
<Col>
<OnlineValidatorBadge />
</Col>
</Row>
</ErrorBoundary>
<Row>
<Col>
<OnlineValidatorBadge />
</Col>
</Row>
</Container>
)
}