The reason for this error is that something is wrong. Helpful, huh? =)
This is the most frequent error message I get as well, it can by far be the most frustrating because lack of input on to what is causing it. (A line error would be nice!)
What I find is causing this in general is that one of the parameters I'm passing to a method is "null" and that particular method can't handle it.
In your catch-block, have you logged e.message? Sometimes this seems go give some more information.
Otherwise I simply use print statements to determine where the code crashes.
/J