2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-23 01:44:31 -06:00

Move custom error classes out of main file

This commit is contained in:
Jeroen akkerman 2023-04-28 03:01:49 +02:00
parent e12e59a003
commit a073a90d26
3 changed files with 16 additions and 16 deletions

View File

@ -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;

View File

@ -0,0 +1,6 @@
export class AlreadyConstructedError extends Error {
public constructor() {
super('EasyMDE is already initialized.');
this.name = 'AlreadyConstructedError';
}
}

View 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';
}
}