extract warn method

if you merge please test it, cause I didn't ;-)