handle pdf api errors