better error handling

fixing AGCORDOVA-38