Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(link checker): wrong error reported #1227

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/services/review/RepoCheckerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,10 @@ export default class RepoCheckerService {
return errAsync("No permalink found in front matter")
}
const normalisedPermalink = this.normalisePermalink(filePermalink)

// we are only parsing out the front matter
const fileContent = file.split("---")?.slice(2).join("---")
if (!fileContent) {
return errAsync("No file content found")
return errAsync(`No page content for ${fileName}`) // it is ok to have no page content
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok w/ the change - the alarm si doing a string search, thus necessitating this change?

}
return okAsync({ fileContent, normalisedPermalink })
})
Expand Down Expand Up @@ -508,9 +507,14 @@ export default class RepoCheckerService {
logger.info(`Site checker for repo ${repo} completed successfully!`)
return ResultAsync.combineWithAllErrors(findErrors)
.orElse((e) => {
logger.error(
`SiteCheckerError: Error running site checker for repo ${repo}: ${e}`
)
const siteCheckerErrors = e.filter(
(err) => err instanceof SiteCheckerError
) as SiteCheckerError[] // type cast safe as we are filtering
if (siteCheckerErrors.length > 0) {
logger.error(
`SiteCheckerError: Error running site checker for repo ${repo}: ${e}`
)
}
// it is ok to have errors, still report the found errors for now
return okAsync([undefined])
})
Expand Down
Loading