mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
chore: move page not found error out of constants (#9547)
This commit is contained in:
14
packages/common/env/src/constant.ts
vendored
14
packages/common/env/src/constant.ts
vendored
@@ -1,7 +1,4 @@
|
||||
// This file should has not side effect
|
||||
// oxlint-disable-next-line
|
||||
// @ts-ignore FIXME: typecheck error
|
||||
import type { Workspace } from '@blocksuite/affine/store';
|
||||
|
||||
declare global {
|
||||
// oxlint-disable-next-line no-var
|
||||
@@ -90,17 +87,6 @@ export const Messages = {
|
||||
};
|
||||
};
|
||||
|
||||
export class PageNotFoundError extends TypeError {
|
||||
readonly docCollection: Workspace;
|
||||
readonly pageId: string;
|
||||
|
||||
constructor(docCollection: Workspace, pageId: string) {
|
||||
super();
|
||||
this.docCollection = docCollection;
|
||||
this.pageId = pageId;
|
||||
}
|
||||
}
|
||||
|
||||
export class WorkspaceNotFoundError extends TypeError {
|
||||
readonly workspaceId: string;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"es-AR": 100,
|
||||
"es-CL": 100,
|
||||
"es": 100,
|
||||
"fa": 100,
|
||||
"fr": 100,
|
||||
"hi": 2,
|
||||
"it-IT": 100,
|
||||
|
||||
Reference in New Issue
Block a user