Encode body of error messages.