On behalf of TommyBeadle: Fixing exception handling when building an inverted predicate. Fixes issue 2397