Added custom error class for api errors