refactor(tts): remove InputError class and use native Error

This commit is contained in:
mitchell 2026-06-16 16:45:17 -04:00
parent 710d2e7593
commit fc7d9101e9

10
tts.ts
View file

@ -12,10 +12,6 @@ import { execa } from "execa";
import { Window } from "happy-dom"; import { Window } from "happy-dom";
import wrapAnsi from "wrap-ansi"; import wrapAnsi from "wrap-ansi";
class InputError extends Error {
override name = "InputError";
}
async function main() { async function main() {
const start = Date.now(); const start = Date.now();
@ -48,9 +44,7 @@ async function main() {
} }
if (!input) { if (!input) {
throw new InputError( throw new Error("No input was given. Use positional arguments or stdin.");
"No input was given. Use positional arguments or stdin.",
);
} }
if (url) { if (url) {
@ -61,7 +55,7 @@ async function main() {
await window.happyDOM.waitUntilComplete(); await window.happyDOM.waitUntilComplete();
const readable = new Readability(doc).parse(); const readable = new Readability(doc).parse();
if (!readable?.textContent) { if (!readable?.textContent) {
throw new InputError( throw new Error(
"Unable to read webpage. This usually means it's blocking scrapers.", "Unable to read webpage. This usually means it's blocking scrapers.",
); );
} }