Skip to content

Commit

Permalink
remove logger from library code (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
wydengyre authored Jan 26, 2024
1 parent b2bd158 commit 4b8d894
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/feed-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export async function feedHandler(
let status = 500;
let body = "<error><code>500</code><message>server error</message></error>";
if (e instanceof NotFoundError) {
logger.error("not found", e);
status = 404;
body = "<error><code>404</code><message>Not Found</message></error>";
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/feed.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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));

Expand Down
1 change: 0 additions & 1 deletion lib/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4b8d894

Please sign in to comment.