A white teenager who killed 10 people in a racist attack at a western New York grocery store in a black neighbourhood had been taken into custody last year and given a mental health evaluation after making a threat at his high school, authorities say.