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

Update PrefixIndexer.scala #56

Closed
wants to merge 0 commits into from
Closed

Conversation

jglesner
Copy link
Contributor

To address Issue #53 (#53), which has to do with regex parsing errors caused during processing of prefixes, I have wrapped this block of code in a try/catch. I am not a scala programmer, so this may not be the best implementation. However, if we do not contain regex errors related to prefix processing, the error bubbles up causing parsing to exit with an error, and the database/index is unusable. Therefore, I feel like its worthwhile to trap the error here, and just skip over processing errors. Submitting this for consideration/feedback. Perhaps it would be even better to trap the specific error identified in Issue #53, rather than trapping all errors.

Copy link
Contributor

@jvandew jvandew left a comment

Choose a reason for hiding this comment

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

thank you for taking the time to put this up! I have a couple questions/comments as someone with only a passing familiarity with this code but otherwise this looks good to me

@@ -112,32 +112,36 @@ class PrefixIndexer(
if (index % 1000 == 0) {
log.info("done with %d of %d prefixes".format(index, numPrefixes))
}
val records = getRecordsByPrefix(prefix, PrefixIndexer.MaxNamesToConsider)
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

honest question: would it make sense to have this wrap just the getRecordsByPrefix call instead of the entire block here? I suppose any exception leaves you in the same broken state, but I'm not sure you would want to ignore every possible error here


prefixWriter.append(prefix, fidsToCanonicalFids(fids.toList))
} catch {
case e: Exception => println("Skipping due to error processing prefixes")
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably at least print the exception here as well, something like e.printStackTrace(System.err) maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants