mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 00:06:09 +08:00
chore(core): better doc action error message (#10288)
This commit is contained in:
@@ -360,7 +360,7 @@ enum ErrorNames {
|
||||
|
||||
CUSTOMER_PORTAL_CREATE_FAILED
|
||||
|
||||
DOC_ACCESS_DENIED
|
||||
DOC_ACTION_DENIED
|
||||
|
||||
DOC_HISTORY_NOT_FOUND
|
||||
|
||||
|
||||
+5
-11
@@ -1,7 +1,7 @@
|
||||
import { Menu, MenuItem, MenuTrigger, notify } from '@affine/component';
|
||||
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
|
||||
import { ShareInfoService } from '@affine/core/modules/share-doc';
|
||||
import { PublicDocMode } from '@affine/graphql';
|
||||
import { PublicDocMode, UserFriendlyError } from '@affine/graphql';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import {
|
||||
@@ -73,18 +73,12 @@ export const PublicDoc = ({ disabled }: { disabled?: boolean }) => {
|
||||
style: 'normal',
|
||||
icon: <SingleSelectCheckSolidIcon color={cssVar('primaryColor')} />,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (error) {
|
||||
const err = UserFriendlyError.fromAnyError(error);
|
||||
notify.error({
|
||||
title:
|
||||
t[
|
||||
'com.affine.share-menu.confirm-modify-mode.notification.fail.title'
|
||||
](),
|
||||
message:
|
||||
t[
|
||||
'com.affine.share-menu.confirm-modify-mode.notification.fail.message'
|
||||
](),
|
||||
title: err.name,
|
||||
message: err.message,
|
||||
});
|
||||
console.error(err);
|
||||
}
|
||||
}, [isSharedPage, shareInfoService.shareInfo, t]);
|
||||
|
||||
|
||||
@@ -144,6 +144,11 @@ export interface CopilotContextListItem {
|
||||
status: Maybe<ContextFileStatus>;
|
||||
}
|
||||
|
||||
export interface CopilotDocNotFoundDataType {
|
||||
__typename?: 'CopilotDocNotFoundDataType';
|
||||
docId: Scalars['String']['output'];
|
||||
}
|
||||
|
||||
export interface CopilotFailedToMatchContextDataType {
|
||||
__typename?: 'CopilotFailedToMatchContextDataType';
|
||||
content: Scalars['String']['output'];
|
||||
@@ -308,8 +313,9 @@ export interface DeleteSessionInput {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface DocAccessDeniedDataType {
|
||||
__typename?: 'DocAccessDeniedDataType';
|
||||
export interface DocActionDeniedDataType {
|
||||
__typename?: 'DocActionDeniedDataType';
|
||||
action: Scalars['String']['output'];
|
||||
docId: Scalars['String']['output'];
|
||||
spaceId: Scalars['String']['output'];
|
||||
}
|
||||
@@ -387,18 +393,20 @@ export type ErrorDataUnion =
|
||||
| AlreadyInSpaceDataType
|
||||
| BlobNotFoundDataType
|
||||
| CopilotContextFileNotSupportedDataType
|
||||
| CopilotDocNotFoundDataType
|
||||
| CopilotFailedToMatchContextDataType
|
||||
| CopilotFailedToModifyContextDataType
|
||||
| CopilotInvalidContextDataType
|
||||
| CopilotMessageNotFoundDataType
|
||||
| CopilotPromptNotFoundDataType
|
||||
| CopilotProviderSideErrorDataType
|
||||
| DocAccessDeniedDataType
|
||||
| DocActionDeniedDataType
|
||||
| DocHistoryNotFoundDataType
|
||||
| DocNotFoundDataType
|
||||
| ExpectToGrantDocUserRolesDataType
|
||||
| ExpectToRevokeDocUserRolesDataType
|
||||
| ExpectToUpdateDocUserRoleDataType
|
||||
| GraphqlBadRequestDataType
|
||||
| InvalidEmailDataType
|
||||
| InvalidHistoryTimestampDataType
|
||||
| InvalidLicenseUpdateParamsDataType
|
||||
@@ -440,6 +448,7 @@ export enum ErrorNames {
|
||||
CAPTCHA_VERIFICATION_FAILED = 'CAPTCHA_VERIFICATION_FAILED',
|
||||
COPILOT_ACTION_TAKEN = 'COPILOT_ACTION_TAKEN',
|
||||
COPILOT_CONTEXT_FILE_NOT_SUPPORTED = 'COPILOT_CONTEXT_FILE_NOT_SUPPORTED',
|
||||
COPILOT_DOC_NOT_FOUND = 'COPILOT_DOC_NOT_FOUND',
|
||||
COPILOT_FAILED_TO_CREATE_MESSAGE = 'COPILOT_FAILED_TO_CREATE_MESSAGE',
|
||||
COPILOT_FAILED_TO_GENERATE_TEXT = 'COPILOT_FAILED_TO_GENERATE_TEXT',
|
||||
COPILOT_FAILED_TO_MATCH_CONTEXT = 'COPILOT_FAILED_TO_MATCH_CONTEXT',
|
||||
@@ -453,7 +462,7 @@ export enum ErrorNames {
|
||||
COPILOT_SESSION_DELETED = 'COPILOT_SESSION_DELETED',
|
||||
COPILOT_SESSION_NOT_FOUND = 'COPILOT_SESSION_NOT_FOUND',
|
||||
CUSTOMER_PORTAL_CREATE_FAILED = 'CUSTOMER_PORTAL_CREATE_FAILED',
|
||||
DOC_ACCESS_DENIED = 'DOC_ACCESS_DENIED',
|
||||
DOC_ACTION_DENIED = 'DOC_ACTION_DENIED',
|
||||
DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER = 'DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER',
|
||||
DOC_HISTORY_NOT_FOUND = 'DOC_HISTORY_NOT_FOUND',
|
||||
DOC_IS_NOT_PUBLIC = 'DOC_IS_NOT_PUBLIC',
|
||||
@@ -470,6 +479,7 @@ export enum ErrorNames {
|
||||
FAILED_TO_CHECKOUT = 'FAILED_TO_CHECKOUT',
|
||||
FAILED_TO_SAVE_UPDATES = 'FAILED_TO_SAVE_UPDATES',
|
||||
FAILED_TO_UPSERT_SNAPSHOT = 'FAILED_TO_UPSERT_SNAPSHOT',
|
||||
GRAPHQL_BAD_REQUEST = 'GRAPHQL_BAD_REQUEST',
|
||||
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
|
||||
INVALID_CHECKOUT_PARAMETERS = 'INVALID_CHECKOUT_PARAMETERS',
|
||||
INVALID_EMAIL = 'INVALID_EMAIL',
|
||||
@@ -583,6 +593,12 @@ export interface GrantedDocUserTypeEdge {
|
||||
node: GrantedDocUserType;
|
||||
}
|
||||
|
||||
export interface GraphqlBadRequestDataType {
|
||||
__typename?: 'GraphqlBadRequestDataType';
|
||||
code: Scalars['String']['output'];
|
||||
message: Scalars['String']['output'];
|
||||
}
|
||||
|
||||
export interface InvalidEmailDataType {
|
||||
__typename?: 'InvalidEmailDataType';
|
||||
email: Scalars['String']['output'];
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"ar": 87,
|
||||
"ar": 88,
|
||||
"ca": 4,
|
||||
"da": 5,
|
||||
"de": 87,
|
||||
"el-GR": 87,
|
||||
"de": 88,
|
||||
"el-GR": 88,
|
||||
"en": 100,
|
||||
"es-AR": 87,
|
||||
"es-AR": 88,
|
||||
"es-CL": 89,
|
||||
"es": 87,
|
||||
"fa": 87,
|
||||
"fr": 87,
|
||||
"es": 88,
|
||||
"fa": 88,
|
||||
"fr": 88,
|
||||
"hi": 2,
|
||||
"it-IT": 87,
|
||||
"it-IT": 88,
|
||||
"it": 1,
|
||||
"ja": 87,
|
||||
"ja": 88,
|
||||
"ko": 63,
|
||||
"pl": 87,
|
||||
"pt-BR": 87,
|
||||
"ru": 87,
|
||||
"sv-SE": 87,
|
||||
"uk": 87,
|
||||
"pl": 88,
|
||||
"pt-BR": 88,
|
||||
"ru": 88,
|
||||
"sv-SE": 88,
|
||||
"uk": 88,
|
||||
"ur": 2,
|
||||
"zh-Hans": 87,
|
||||
"zh-Hant": 87
|
||||
"zh-Hans": 88,
|
||||
"zh-Hant": 88
|
||||
}
|
||||
|
||||
@@ -5708,19 +5708,19 @@ export function useAFFiNEI18N(): {
|
||||
*/
|
||||
["com.affine.settings.workspace.affine-ai.description"](): string;
|
||||
/**
|
||||
* `Achieved workspaces`
|
||||
* `Archived workspaces`
|
||||
*/
|
||||
["com.affine.settings.workspace.backup"](): string;
|
||||
/**
|
||||
* `Management in local workspace backup files`
|
||||
* `Manage archived local workspace files`
|
||||
*/
|
||||
["com.affine.settings.workspace.backup.subtitle"](): string;
|
||||
/**
|
||||
* `No backup files found`
|
||||
* `No archived workspace files found`
|
||||
*/
|
||||
["com.affine.settings.workspace.backup.empty"](): string;
|
||||
/**
|
||||
* `Delete backup workspace`
|
||||
* `Delete archived workspace`
|
||||
*/
|
||||
["com.affine.settings.workspace.backup.delete"](): string;
|
||||
/**
|
||||
@@ -5790,14 +5790,6 @@ export function useAFFiNEI18N(): {
|
||||
* `Shared doc`
|
||||
*/
|
||||
["com.affine.share-menu.SharedPage"](): string;
|
||||
/**
|
||||
* `Please try again later.`
|
||||
*/
|
||||
["com.affine.share-menu.confirm-modify-mode.notification.fail.message"](): string;
|
||||
/**
|
||||
* `Failed to modify`
|
||||
*/
|
||||
["com.affine.share-menu.confirm-modify-mode.notification.fail.title"](): string;
|
||||
/**
|
||||
* `Copy Link`
|
||||
*/
|
||||
@@ -7199,11 +7191,11 @@ export function useAFFiNEI18N(): {
|
||||
spaceId: string;
|
||||
}>): string;
|
||||
/**
|
||||
* `You do not have permission to access doc {{docId}} under Space {{spaceId}}.`
|
||||
* `You do not have permission to perform {{action}} action on doc {{docId}}.`
|
||||
*/
|
||||
["error.DOC_ACCESS_DENIED"](options: Readonly<{
|
||||
["error.DOC_ACTION_DENIED"](options: Readonly<{
|
||||
action: string;
|
||||
docId: string;
|
||||
spaceId: string;
|
||||
}>): string;
|
||||
/**
|
||||
* `Your client with version {{version}} is rejected by remote sync server. Please upgrade to {{serverVersion}}.`
|
||||
|
||||
@@ -1446,8 +1446,6 @@
|
||||
"com.affine.share-menu.ShareWithLink": "Share with link",
|
||||
"com.affine.share-menu.ShareWithLinkDescription": "Create a link you can easily share with anyone. The visitors will open your doc in the form od a document",
|
||||
"com.affine.share-menu.SharedPage": "Shared doc",
|
||||
"com.affine.share-menu.confirm-modify-mode.notification.fail.message": "Please try again later.",
|
||||
"com.affine.share-menu.confirm-modify-mode.notification.fail.title": "Failed to modify",
|
||||
"com.affine.share-menu.copy": "Copy Link",
|
||||
"com.affine.share-menu.copy-private-link": "Copy private link",
|
||||
"com.affine.share-menu.copy.block": "Copy Link to Selected Block",
|
||||
@@ -1783,7 +1781,7 @@
|
||||
"error.SPACE_OWNER_NOT_FOUND": "Owner of Space {{spaceId}} not found.",
|
||||
"error.SPACE_SHOULD_HAVE_ONLY_ONE_OWNER": "Space should have only one owner.",
|
||||
"error.DOC_NOT_FOUND": "Doc {{docId}} under Space {{spaceId}} not found.",
|
||||
"error.DOC_ACCESS_DENIED": "You do not have permission to access doc {{docId}} under Space {{spaceId}}.",
|
||||
"error.DOC_ACTION_DENIED": "You do not have permission to perform {{action}} action on doc {{docId}}.",
|
||||
"error.VERSION_REJECTED": "Your client with version {{version}} is rejected by remote sync server. Please upgrade to {{serverVersion}}.",
|
||||
"error.INVALID_HISTORY_TIMESTAMP": "Invalid doc history timestamp provided.",
|
||||
"error.DOC_HISTORY_NOT_FOUND": "History of {{docId}} at {{timestamp}} under Space {{spaceId}}.",
|
||||
|
||||
Reference in New Issue
Block a user