Skip to content

Simple question parsing. #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stopping
Copy link

@stopping stopping commented May 5, 2015

No description provided.

@@ -63,7 +64,7 @@ private TceClassPageParser(Document page) {
STATE_READING_RESULTS,
}

private TceClassProto buildModel() {
private TceClassProto buildModel() throws ParseException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a fan of needing "throws" declarations---they end up being awkward to use due to language requirements. I think your implementation re-throwing it a couple levels and then ending up with a printStackTrace and a TODO is evidence of it being an "anti-pattern". Unfortunately, ParseException is an Exception and not a RuntimeException, so the language leaves you no choice (again, "anti-pattern").

How do you feel about just throwing it as a RuntimeException (to avoid the language shenanigans)? Then later, for proper handling, we can install a few high-level exception handlers: e.g. an Exception caught while doing downloading/parsing of all the pages could gracefully retry (for something like a network failure) or forcefully exit (for a deterministic parsing failure), while a frontend failure while serving the site should be logged but not bring down the server.

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