fix: Catch expected error when shares.info returns 404
This commit is contained in:
parent
d2b9a5c03f
commit
68dcb4de5f
|
@ -6,6 +6,7 @@ import type { Location, RouterHistory, Match } from "react-router-dom";
|
|||
import { observable } from "mobx";
|
||||
import { observer, inject } from "mobx-react";
|
||||
import { matchDocumentEdit, updateDocumentUrl } from "utils/routeHelpers";
|
||||
import { NotFoundError, OfflineError } from "utils/errors";
|
||||
import DocumentComponent from "./Document";
|
||||
import Revision from "models/Revision";
|
||||
import Document from "models/Document";
|
||||
|
@ -19,7 +20,6 @@ import SharesStore from "stores/SharesStore";
|
|||
import PoliciesStore from "stores/PoliciesStore";
|
||||
import RevisionsStore from "stores/RevisionsStore";
|
||||
import UiStore from "stores/UiStore";
|
||||
import { OfflineError } from "utils/errors";
|
||||
|
||||
type Props = {|
|
||||
match: Match,
|
||||
|
@ -130,7 +130,11 @@ class DataLoader extends React.Component<Props> {
|
|||
return this.goToDocumentCanonical();
|
||||
}
|
||||
|
||||
this.props.shares.fetch(document.id);
|
||||
this.props.shares.fetch(document.id).catch(err => {
|
||||
if (!(err instanceof NotFoundError)) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
const isMove = this.props.location.pathname.match(/move$/);
|
||||
const canRedirect = !revisionId && !isMove && !shareId;
|
||||
|
|
Reference in New Issue