Convert exception to a string