Extract error message from API result