mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-23 09:54:28 -06:00
Move custom error classes out of main file
This commit is contained in:
parent
e12e59a003
commit
a073a90d26
@ -10,27 +10,13 @@ import { drawSelection, EditorView } from '@codemirror/view';
|
||||
import { tags } from '@lezer/highlight';
|
||||
import { marked } from 'marked';
|
||||
|
||||
import { AlreadyConstructedError } from "./errors/already-constructed-error";
|
||||
import { NotConstructedError } from "./errors/not-constructed-error";
|
||||
import { InputOptions, Options } from './options';
|
||||
|
||||
import './styles.scss';
|
||||
import { importDefaultToolbar, importToolbar } from '.';
|
||||
|
||||
class NotConstructedError extends Error {
|
||||
public constructor() {
|
||||
super(
|
||||
'EasyMDE is not initialized, run the "construct()" method to do so.',
|
||||
);
|
||||
this.name = 'NotConstructedError';
|
||||
}
|
||||
}
|
||||
|
||||
class AlreadyConstructedError extends Error {
|
||||
public constructor() {
|
||||
super('EasyMDE is already initialized.');
|
||||
this.name = 'AlreadyConstructedError';
|
||||
}
|
||||
}
|
||||
|
||||
export class EasyMDE {
|
||||
private readonly element: HTMLTextAreaElement;
|
||||
#container?: HTMLDivElement;
|
||||
|
6
src/errors/already-constructed-error.ts
Normal file
6
src/errors/already-constructed-error.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export class AlreadyConstructedError extends Error {
|
||||
public constructor() {
|
||||
super('EasyMDE is already initialized.');
|
||||
this.name = 'AlreadyConstructedError';
|
||||
}
|
||||
}
|
8
src/errors/not-constructed-error.ts
Normal file
8
src/errors/not-constructed-error.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export class NotConstructedError extends Error {
|
||||
public constructor() {
|
||||
super(
|
||||
'EasyMDE is not initialized, run the "construct()" method to do so.',
|
||||
);
|
||||
this.name = 'NotConstructedError';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user