Catch the exception sent by boost::format in print method