Cleaned up giveError handler