diff --git a/lib/error.ts b/lib/error.ts new file mode 100644 index 0000000..fc65893 --- /dev/null +++ b/lib/error.ts @@ -0,0 +1,6 @@ +export class NotFoundError extends Error { + constructor(url: URL) { + super(`Not found: ${url}`); + this.name = "NotFoundError"; + } +} diff --git a/lib/feed-handler.ts b/lib/feed-handler.ts index c635fde..e67c40b 100644 --- a/lib/feed-handler.ts +++ b/lib/feed-handler.ts @@ -1,5 +1,6 @@ import { createResponse } from "itty-router"; -import { NotFoundError, convertFeed } from "./feed.js"; +import { NotFoundError } from "./error.js"; +import { convertFeed } from "./feed.js"; import { Logger } from "./logger.js"; type Config = { diff --git a/lib/feed.test.ts b/lib/feed.test.ts index b8282d1..ed57203 100644 --- a/lib/feed.test.ts +++ b/lib/feed.test.ts @@ -1,13 +1,13 @@ import { strict as assert } from "node:assert"; import test from "node:test"; import { error, json } from "itty-router"; +import { NotFoundError } from "./error.js"; import { Convertor, ConvertorConf, FeedConf, FeedFetcher, FetcherConf, - NotFoundError, convertFeed, } from "./feed.js"; import { Fetcher as MediaFetcher } from "./media.js"; diff --git a/lib/feed.ts b/lib/feed.ts index f5d9809..5f4c175 100644 --- a/lib/feed.ts +++ b/lib/feed.ts @@ -1,6 +1,7 @@ import { PromisePool } from "@supercharge/promise-pool"; import { z } from "zod"; import { Podcast } from "../build/podcast/index.js"; +import { NotFoundError } from "./error.js"; import { Fetcher as MediaFetcher } from "./media.js"; const cardSchema = z.object({ @@ -77,13 +78,6 @@ export class FeedFetcher { } } -export class NotFoundError extends Error { - constructor(url: URL) { - super(`Not found: ${url}`); - this.name = "NotFoundError"; - } -} - export type ConvertorConf = { raiBaseUrl: URL; poolSize: number;