Check for specific exception raised in FlagCollection instead of string content of exception

This closes one of the windows 64-bit test failures on appveyor seen in #2755
Honestly this isn't necessary here.  I rarely put fixes to tests in the changelog.  It's not relevant to users unless it's a test that has failed frequently and often for many people.