Show the name of the trait in the error message

fix #5925