Implement error message generation method