title: How to ignore wrong fields when parsing a text-format protobuf message
body: <p>I simulate a text-format file parsing with wrong field in c++.</p>
  
  <p>My simple test .proto file:</p>
  
  <pre><code>$ cat settings.proto
  package settings;
  message Settings {
     optional int32  param1 = 1;
     optional string param2 = 2;
     optional bytes  param3 = 3;
  }
  </code></pre>
  
  <p>My text-format file:</p>
  
  <pre><code>$ cat settings.txt
  param1: 123
  param: "some string"
  param3: "another string"
  </code></pre>
  
  <p>I am parsing a file with the google::protobuf::TextFormat::Parser:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;fstream&gt;
  #include &lt;google/protobuf/text_format.h&gt;
  #include &lt;google/protobuf/io/zero_copy_stream_impl.h&gt;
  
  #include &lt;settings.pb.h&gt;
  
  using namespace std;
  
  int main( int argc, char* argv[] )
  {
      GOOGLE_PROTOBUF_VERIFY_VERSION;
  
      settings::Settings settings;
  
      int fd = open( argv[1], O_RDONLY );
      if( fd &lt; 0 )
      {
          cerr &lt;&lt; " Error opening the file " &lt;&lt; endl;
          return false;
      }
  
      google::protobuf::io::finputStream finput( fd );
      finput.SetCloseOnDelete( true );
  
      google::protobuf::TextFormat::Parser parser;
      parser.AllowPartialMessage( true );
  
      if ( !parser.Parce( &amp;finput, &amp;settings ) )
      {
          cerr &lt;&lt; "Failed to parse file!" &lt;&lt; endl;
      }
  
      cout &lt;&lt; settings.DebugString() &lt;&lt; endl;
  
      google::protobuf::ShutdownProtobufLibrary();
  
      std::cout &lt;&lt; "Exit" &lt;&lt; std::endl;
      return true;
  }
  </code></pre>
  
  <p>I set AllowPartialMessage to true for parser. All fields are optional.
  But currently Parse stops parsing after first wrong field. And after parsing "settings" contains only one first field.</p>
  
  <p>Is there way to notify about fail and continue parsing another correct fields?</p>