refactor(tts): remove InputError class and use native Error
This commit is contained in:
parent
710d2e7593
commit
fc7d9101e9
1 changed files with 2 additions and 8 deletions
10
tts.ts
10
tts.ts
|
|
@ -12,10 +12,6 @@ import { execa } from "execa";
|
|||
import { Window } from "happy-dom";
|
||||
import wrapAnsi from "wrap-ansi";
|
||||
|
||||
class InputError extends Error {
|
||||
override name = "InputError";
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const start = Date.now();
|
||||
|
||||
|
|
@ -48,9 +44,7 @@ async function main() {
|
|||
}
|
||||
|
||||
if (!input) {
|
||||
throw new InputError(
|
||||
"No input was given. Use positional arguments or stdin.",
|
||||
);
|
||||
throw new Error("No input was given. Use positional arguments or stdin.");
|
||||
}
|
||||
|
||||
if (url) {
|
||||
|
|
@ -61,7 +55,7 @@ async function main() {
|
|||
await window.happyDOM.waitUntilComplete();
|
||||
const readable = new Readability(doc).parse();
|
||||
if (!readable?.textContent) {
|
||||
throw new InputError(
|
||||
throw new Error(
|
||||
"Unable to read webpage. This usually means it's blocking scrapers.",
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue