mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
refactor(editor): remove assertExists (#10615)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { BlockSuiteError } from '@blocksuite/global/exceptions';
|
||||
import type { ExtensionType } from '@blocksuite/store';
|
||||
|
||||
import { SpecBuilder } from './spec-builder.js';
|
||||
@@ -45,7 +45,12 @@ export class SpecProvider {
|
||||
|
||||
getSpec(id: SpecId) {
|
||||
const spec = this.specMap.get(id);
|
||||
assertExists(spec, `Spec not found for ${id}`);
|
||||
if (!spec) {
|
||||
throw new BlockSuiteError(
|
||||
BlockSuiteError.ErrorCode.ValueNotExists,
|
||||
`Spec not found for ${id}`
|
||||
);
|
||||
}
|
||||
return new SpecBuilder(spec);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user