fix(core): log error detail when import failed (#8930)

This commit is contained in:
donteatfriedrice 2024-11-26 16:09:38 +00:00
parent 6ac8cca440
commit e3a8f1e9bd
No known key found for this signature in database
GPG Key ID: 710A67A6AC71FD16

View File

@ -5,6 +5,7 @@ import type {
WORKSPACE_DIALOG_SCHEMA, WORKSPACE_DIALOG_SCHEMA,
} from '@affine/core/modules/dialogs'; } from '@affine/core/modules/dialogs';
import { UrlService } from '@affine/core/modules/url'; import { UrlService } from '@affine/core/modules/url';
import { DebugLogger } from '@affine/debug';
import { useI18n } from '@affine/i18n'; import { useI18n } from '@affine/i18n';
import track from '@affine/track'; import track from '@affine/track';
import { import {
@ -30,6 +31,8 @@ import { type ReactElement, useCallback, useState } from 'react';
import * as style from './styles.css'; import * as style from './styles.css';
const logger = new DebugLogger('import');
type ImportType = 'markdown' | 'markdownZip' | 'notion' | 'snapshot' | 'html'; type ImportType = 'markdown' | 'markdownZip' | 'notion' | 'snapshot' | 'html';
type AcceptType = 'Markdown' | 'Zip' | 'Html'; type AcceptType = 'Markdown' | 'Zip' | 'Html';
type Status = 'idle' | 'importing' | 'success' | 'error'; type Status = 'idle' | 'importing' | 'success' | 'error';
@ -421,6 +424,7 @@ export const ImportDialog = ({
status: 'failed', status: 'failed',
error: errorMessage || undefined, error: errorMessage || undefined,
}); });
logger.error('Failed to import', error);
} }
}, },
[docCollection, t] [docCollection, t]