Change error from constants to enum.