Created
December 29, 2016 23:56
-
-
Save mbdavid/6c693fc28ededabc8683de2f4d1364c9 to your computer and use it in GitHub Desktop.
Catch in IEnumerable Yield
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// why this do not work? | |
public IEnumerable<T> Find(Query query) | |
{ | |
while(true) | |
{ | |
try | |
{ | |
// FindWrap returns IEnumerable using yield return | |
return FindWrap(query); | |
} | |
catch(IndexNotFoundException ex) | |
{ | |
// never run this!! | |
this.EnsureIndex(ex); | |
} | |
catch(Exception ex) | |
{ | |
// doesn't works here too | |
} | |
finaly | |
{ | |
// where it's ok | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote this:
Work for IEnumerable/Catch exception but it's not valid in this case: locking problems (as #399).