This is a somewhat controversial change, but I have found it very convenient when running clang-query on entire projects.
When searching for a code pattern in an entire project with a compilation database it's tempting to run
clang-query *.cpp
And yet, that often breaks because some files are just not in the compilation database: tests, sample code, etc.
I don't think clang-query should stop when encountering such cases.
These error codes are undocumented, so I would probably stick with a single != 0 check.
But up to you.