Perhaps this is a dumb question, but I have to ask it:
Are you sure you have defined those constants you use correctly at the top of your script? Such as:
js code:
var ERROR_SUCCESS = 0x0;
since those are not set by Plus! itself, you need to define them yourself.