Soooo long story short, don't predicate the validity or non-validity of a texture object on its GL handle. glGenTextures et al won't ever return 0, which you can use to detect errors at the point of call. Handle that appropriately, but don't use the value itself as your check.
The reason I have gotten confused is glGetUniformLocation as a location of 0 is perfectly valid. What is a good default for that, -1?
Unlike the Gen functions, glGetUniformLocation returns a signed value and -1 is a perfectly sane default, as well as the error value for the function itself.
All of which takes us back to the problem that the entire API feels like it was carelessly mashed together from pieces that were lying around and everyone is worse off for it.