Skip to content

Commit d3b610b

Browse files
authored
Convert console logs to firebase function logs in catch blocks - handling the error ourselves has been masking issues where we'd want to investigate even if we don't want the fallback to blow up the whole function execution (particularly in batch scrape jobs). This commit handles the scrapeHearings function where we saw the issue, but there will be follow-ups shortly to handle other functions we have seen this for (#2170)
1 parent b7ddd9d commit d3b610b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

functions/src/events/scrapeEvents.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const extractAudioFromVideo = async (
171171
resolve()
172172
})
173173
.on("error", err => {
174-
console.error("FFmpeg error:", err)
174+
functions.logger.error("FFmpeg error:", err)
175175
reject(err)
176176
})
177177
.save(tmpFilePath)
@@ -394,7 +394,10 @@ class HearingScraper extends EventScraper<HearingListItem, Hearing> {
394394
} as Hearing
395395
}
396396
} catch (error) {
397-
console.error(`Failed to process audio for hearing ${EventId}:`, error)
397+
functions.logger.error(
398+
`Failed to process audio for hearing ${EventId}:`,
399+
error
400+
)
398401
return {
399402
id: `hearing-${EventId}`,
400403
type: "hearing",
@@ -460,7 +463,7 @@ export const scrapeSingleHearing = functions
460463
hearingId: hearing.id
461464
}
462465
} catch (error: any) {
463-
console.error(`Failed to scrape hearing ${eventId}:`, error)
466+
functions.logger.error(`Failed to scrape hearing ${eventId}:`, error)
464467
throw new functions.https.HttpsError(
465468
"internal",
466469
`Failed to scrape hearing ${eventId}`,
@@ -505,7 +508,7 @@ export const scrapeSingleHearingv2 = onCall(
505508
hearingId: hearing.id
506509
}
507510
} catch (error: any) {
508-
console.error(`Failed to scrape hearing ${eventId}:`, error)
511+
functions.logger.error(`Failed to scrape hearing ${eventId}:`, error)
509512
throw new functions.https.HttpsError(
510513
"internal",
511514
`Failed to scrape hearing ${eventId}`,

0 commit comments

Comments
 (0)