chore: move page not found error out of constants (#9547)

This commit is contained in:
Saul-Mirone
2025-01-07 05:57:37 +00:00
parent df6a6ac392
commit 0d2eb64817
8 changed files with 26 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
import { PageNotFoundError } from '@affine/env/constant';
import { useI18n } from '@affine/i18n';
import type { Workspace } from '@blocksuite/affine/store';
import { useCallback } from 'react';
import {
@@ -9,6 +9,17 @@ import {
import { ErrorDetail, ErrorStatus } from '../error-basic/error-detail';
import { createErrorFallback } from '../error-basic/fallback-creator';
class PageNotFoundError extends TypeError {
readonly docCollection: Workspace;
readonly pageId: string;
constructor(docCollection: Workspace, pageId: string) {
super();
this.docCollection = docCollection;
this.pageId = pageId;
}
}
export const PageNotFoundDetail = createErrorFallback(PageNotFoundError, () => {
const t = useI18n();
const { jumpToIndex } = useNavigateHelper();