Skip to content

Commit

Permalink
Add one more error boundary layer for not found (airbytehq#11626)
Browse files Browse the repository at this point in the history
* Add one more error boundary layer for not found

* Fix import paths
  • Loading branch information
jamakase authored Apr 1, 2022
1 parent 22f2206 commit 4b9a077
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React from "react";
import { FormattedMessage } from "react-intl";
import { isVersionError } from "core/request/VersionError";
import { ErrorOccurredView } from "views/common/ErrorOccurredView";
import { StartOverErrorView } from "views/common/StartOverErrorView";
import { ResourceNotFoundErrorBoundary } from "views/common/ResorceNotFoundErrorBoundary";

type BoundaryState = { errorId?: string; message?: string };

Expand Down Expand Up @@ -55,7 +57,9 @@ class ApiErrorBoundary extends React.Component<unknown, BoundaryState> {
}

return !this.state.errorId ? (
this.props.children
<ResourceNotFoundErrorBoundary errorComponent={<StartOverErrorView />}>
{this.props.children}
</ResourceNotFoundErrorBoundary>
) : (
<ErrorOccurredView message="Unknown error occurred" />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export class ResourceNotFoundErrorBoundary extends React.Component<
BoundaryState
> {
static getDerivedStateFromError(error: CommonRequestError): BoundaryState {
if (error.status === 422) {
console.log(error.status);
if (error.status === 422 || error.status === 404) {
return {
hasError: true,
message: <FormattedMessage id="errorView.notFound" />,
Expand Down

0 comments on commit 4b9a077

Please sign in to comment.