Check that 'err' is an object.

The previous commit adds an 'is v0.10?' check but forgot to check that
the expected error object is really an object and not null or undefined.