+/*! \brief
+ * Formats an error message for reporting an exception.
+ *
+ * \param writer Writer to use for writing the message.
+ * \param[in] ex Exception to format.
+ * \throws std::bad_alloc if out of memory.
+ */
+void formatExceptionMessageToWriter(TextWriter *writer,
+ const std::exception &ex);