The logical structure of this if statement needs to change slightly. I believe it actually needs to be:

!(responseObject is dictionary) && !(responseObject is array)
then: error

The above is pseudocode, but thats what it should be. NOT isKindOfClass dictionary, AND NOT isKindOfClass array. We need both of those failure conditions to be true when we throw the error.