From 4b8d894dfc92e071ac41b39d5ecdcd3023e5c6c1 Mon Sep 17 00:00:00 2001 From: Matt Leon <108271225+wydengyre@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:37:18 +0700 Subject: [PATCH] remove logger from library code (#8) --- lib/feed-handler.ts | 1 - lib/feed.ts | 6 +++--- lib/handler.ts | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/feed-handler.ts b/lib/feed-handler.ts index 9a9ee4f..163a17d 100644 --- a/lib/feed-handler.ts +++ b/lib/feed-handler.ts @@ -24,7 +24,6 @@ export async function feedHandler( let status = 500; let body = "500server error"; if (e instanceof NotFoundError) { - logger.error("not found", e); status = 404; body = "404Not Found"; } else { diff --git a/lib/feed.ts b/lib/feed.ts index 53ed508..279fba8 100644 --- a/lib/feed.ts +++ b/lib/feed.ts @@ -1,7 +1,6 @@ import { PromisePool } from "@supercharge/promise-pool"; import { z } from "zod"; import { Podcast } from "../build/podcast/index.js"; -import { logger } from "./logger.js"; import { Fetcher as MediaFetcher } from "./media.js"; const cardSchema = z.object({ @@ -129,8 +128,9 @@ export class Convertor { .withConcurrency(this.#poolSize) .useCorrespondingResults() .handleError(async (err, card) => { - logger.error(`Failed to convert card ${card.episode_title}`, err); - throw err; + throw new Error( + `Failed to convert card ${card.episode_title}: ${err.message}`, + ); }) .process(this.convertCard.bind(this)); diff --git a/lib/handler.ts b/lib/handler.ts index 04ae0f2..2cf2477 100644 --- a/lib/handler.ts +++ b/lib/handler.ts @@ -3,7 +3,6 @@ import { feedHandler } from "./feed-handler.js"; import { indexHandler } from "./index-handler.js"; import { logger } from "./logger.js"; -// TODO: add logging export type FetchHandlerConfig = { englishIndexHtml: string; italianIndexHtml: string;