Improve API for formatting exit reasons