How do you react when one of your best people makes a mistake?

Effective leaders know that every individual is unique, and different situations call for different responses.

But mistakes are wonderful opportunities. For example, by sharing instances in which you’ve committed similar missteps, you make yourself more approachable to your team. Further, you can share what you learned from those errors, allowing them to benefit from your experience. If done properly, your team will begin to see you as a coach or mentor, instead of just a boss or manager.

Additionally, you can also use employee mistakes to build loyalty and trust.

How so?

I once led a team of older colleagues, with only a single person younger than myself, whom I’ll call Jason. Jason had everything going for him: He was a smart and skilled worker, but also humble and eager to learn.

One day, Jason sent me a message out of desperation. He was assigned to lead a group of trainees the following day, but had completely forgotten and was out of town. (His attempts to get a last-minute substitute were also unsuccessful.)

Normally this would have been no big deal, but Jason had been guilty of this a couple of times, and I was afraid he was developing a pattern. I needed some time to think the situation through; so, I decided to send a short reply for the time being, thanking Jason for letting me know, and that I would take care of it.

Jason quickly texted back, thanking me and apologizing profusely for the mistake.

This spurred my thinking: I knew Jason well, and it was obvious he felt guilty about again forgetting his assignment. But there was something more: These recent oversights weren’t like him. Jason had been recently promoted, and he was doing great with his new position. But since we were understaffed, he continued to carry many of his old responsibilities. Maybe I needed to spread things out a little more.

I didn’t want to excuse Jason’s actions, but I wanted him to to know how much I appreciated his efforts, as well as the overall quality of his work.

So I sent another reply:

“Hey, don’t beat yourself up. Mistakes happen…You’re doing a lot around here and I really appreciate your willing spirit and the quality of your work. It’s great having you on my team.”

Another quick message from Jason revealed that he was in good spirits, and grateful for the commendation. For as long as we worked together, he proved to be an invaluable member of the team.

So, what’s the takeaway?

Get to know your people well: their goals, their style of working, their personalities and behavior. Then, when someone makes a mistake, consider both the person and the person’s current circumstances. Of course, big mistakes shouldn’t just be overlooked, or they’ll be sure to repeat themselves. When they happen, ask yourself: How can I take advantage of this?

By doing this, mistakes become more than simple teaching moments–they become the building blocks of trusting and loyal relationships.

Enjoy this post? Check out my book, EQ Applied, which uses fascinating research and compelling stories to illustrate what emotional intelligence looks like in everyday life.

A version of this article originally appeared on Inc.com.