Skip to content

Commit

Permalink
Log errors as JSONs
Browse files Browse the repository at this point in the history
  • Loading branch information
franekmagiera committed Feb 11, 2024
1 parent be511cc commit 2bd8180
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/src/get-youtube-video-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ async function getYoutubeVideoSummary(
): Promise<Ok<string> | InternalFailure> {
const getYoutubeCaptionsResult = await getYoutubeCaptions(videoId);
if (getYoutubeCaptionsResult.result === Result.Failure) {
console.error(
getYoutubeCaptionsResult.failure,
getYoutubeCaptionsResult.message || "",
);
console.error({
errorType: getYoutubeCaptionsResult.failure,
errorMessage: getYoutubeCaptionsResult.message || "",
});
// Couldn't get youtube captions, propagate the failure.
return getYoutubeCaptionsResult;
}
const captions = getYoutubeCaptionsResult.data;
const summary = await getCaptionsSummary(captions);
if (summary.result === Result.Failure) {
console.error(
summary.failure,
summary.message || "",
);
console.error({
errorType: summary.failure,
errorMessage: summary.message || "",
});
}
return summary;
}

0 comments on commit 2bd8180

Please sign in to comment.