Add functionality to report API errors

This will help to diagnose invalid CL API calls