@Override
  public Object serializeError(ResultStatus error) {
    CSVPrinter csvPrinter = null;
    try {
      StringBuffer buffer = new StringBuffer();
      csvPrinter = new CSVPrinter(buffer, CSVFormat.DEFAULT);

      csvPrinter.printRecord(Arrays.asList("status", "message"));
      csvPrinter.printRecord(Arrays.asList(error.getStatus().getStatus(), error.getMessage()));

      return buffer.toString();
    } catch (IOException e) {
      //todo: exception handling.  Create ResultStatus 500 and call serializeError
      throw new RuntimeException("Unable to serialize to csv: " + e, e);
    } finally {
      Closeables.closeSilently(csvPrinter);
    }
  }
Serialize the result into a CSV-formatted text document.
<p/>
It is expected that the result set is a collection of flat resources - no sub-resources will be
included in the output.  The root of the tree structure may have a column map (csv_column_map)
and a column order (csv_column_order) property set to indicate the header record and ordering
of the columns.
<p/>
The csv_column_map is a map of resource property names to header descriptive names.  If not
specified, a header record will not be serialized.
<p/>
The csv_column_order is a list of resource property names declaring the order of the columns.
If not specified, the order will be taken from the key order of csv_column_map or the "natural"
ordering of the resource property names, both may be unpredictable.

@param result internal result
@return a String containing the CSV-formatted document
ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java