How create a trigger when error in lua for scenes and events?

Sometimes, i one of my controller have error in lua for scenes and events, how can i create a trigger when that happen then reload lua?