add custom error class for API responses