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

Stream reader could defer raising exceptions to end of input buffer #41

Closed
liamw9534 opened this issue Sep 1, 2015 · 2 comments
Closed

Comments

@liamw9534
Copy link

Just a thought but you might want to consider allowing the stream reader to defer parsing exceptions rather than raising them immediately to the caller. The problem with raising the exceptions immediately is that you then drop out and lose the remainder of the stream buffer even though it might contain legitimate data after an item that caused the parser to fail.

@ajRiverav
Copy link

ajRiverav commented Dec 12, 2016

I second this suggestion.

As a quick workaround for my project, I added a second, optional parameter to NMEASentence's parse() (in nmea.py):

parse(line, check=False, stopIfParseError=True):

If the parser fails, instead of raising an error, it returns None and continues with the data stream.

Stream.py's call to parse() would have stopIfParseError=False.

@Knio Knio closed this as completed in d125c0a Dec 12, 2016
@Knio
Copy link
Owner

Knio commented Dec 12, 2016

Added some basic error handling in 1.7.0

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

No branches or pull requests

3 participants