Merge pull request #8651 from overleaf/em-transient-warnings

Stop on first error: filter out transient warnings

GitOrigin-RevId: ec17a24e05ec28106fdc11f3d3a9e243ae191547
This commit is contained in:
Eric Mc Sween 2022-07-04 08:25:24 -04:00 committed by Copybot
parent 5a3318f5b3
commit cc9b490ef6

View file

@ -3,6 +3,8 @@ import HumanReadableLogs from '../../../ide/human-readable-logs/HumanReadableLog
import BibLogParser from '../../../ide/log-parser/bib-log-parser'
import { v4 as uuid } from 'uuid'
// Warnings that may disappear after a second LaTeX pass
const TRANSIENT_WARNING_REGEX = /^(Reference|Citation).+undefined on input line/
const searchParams = new URLSearchParams(window.location.search)
export function handleOutputFiles(outputFiles, projectId, data) {
@ -79,7 +81,7 @@ export const handleLogFiles = async (outputFiles, data, signal) => {
result.log = await response.text()
const { errors, warnings, typesetting } = HumanReadableLogs.parse(
let { errors, warnings, typesetting } = HumanReadableLogs.parse(
result.log,
{
ignoreDuplicates: true,
@ -88,6 +90,11 @@ export const handleLogFiles = async (outputFiles, data, signal) => {
}
)
if (data.status === 'stopped-on-first-error') {
// Hide warnings that could disappear after a second pass
warnings = warnings.filter(warning => !isTransientWarning(warning))
}
accumulateResults({ errors, warnings, typesetting })
} catch (e) {
console.warn(e) // ignore failure to fetch/parse the log file, but log a warning
@ -179,3 +186,7 @@ function normalizeFilePath(path, rootDocDirname) {
return path
}
function isTransientWarning(warning) {
return TRANSIENT_WARNING_REGEX.test(warning.message)
}