made api.js errors more explicit