error handeling revamp to get proper message