better error handling in Cordova compass example