move formatFailureMessage to utils