The message doesn't say anything more than that X++ threw "some" error. That's not much information.
I think you should first collect more information (using the debugger). It may help you to resolve the problem by yourself or at least it will give us more information to with.