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

check for errors on iteration #1

Open
brentp opened this issue Dec 8, 2017 · 1 comment
Open

check for errors on iteration #1

brentp opened this issue Dec 8, 2017 · 1 comment

Comments

@brentp
Copy link

brentp commented Dec 8, 2017

I've hit this in other libraries as well. sam_read1 and most iterators in htslib return -1 for end of iterator and < -1 on error. It's important to know the difference. Otherwise, on a corrupt bam or network error, it will not detect an error it will just stop iteration.

This problem is seen here:

if (sam_read1(file.fp, _hdrs[file.idx].GetHeaderStruct(), rec_ptr) >= 0)

@38
Copy link
Owner

38 commented Dec 8, 2017

So when it's an error we should set the error string of this BamAlignment.

Returnting false on either error or EOF is the behavior of BamTools.

Currently I haven't implemnet the error string yet. But this is a good note for we should add the error string for the error cases later.

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

2 participants