title: rapidjson crashed when json value should be INT but send as string type
body: <p>I have a C++ code that parses incoming json message using rapidjson. </p>
  
  <p>The json message received contains one key:value pair ("userID": 100), where the value is an integer.</p>
  
  <p>However, if the value is sent as a string '100', rapidjson crashed the whole program with the following error:</p>
  
  <pre><code>Invalid response: { "error": "ERR_RATE_LIMIT"}
  trading: ../../include/rapidjson/document.h:1737: int rapidjson::GenericValue&lt;Encoding, Allocator&gt;::GetInt() const [with Encoding = rapidjson::UTF8&lt;&gt;; Allocator = rapidjson::MemoryPoolAllocator&lt;&gt;]: Assertion `data_.f.flags &amp; kIntFlag' failed.
  /home/ray/dev/trading_execution/src/trading/trading.run.sh: line 39:  2518 Aborted                 (core dumped) ./trading 1234
  </code></pre>
  
  <p>I would expect rapidjson can handle this more gently than crashing the program.</p>
  
  <p>Any suggestion how to deal with this situation? For example, is there a better way to handle the error?</p>
  
  <p>Json message:</p>
  
  <pre><code>{
     "ctRequestId":   "cfa5511f-8c1a-492b-b81a-1462d03bbe99",
      "requestType":  "generic",  
      "userID":       100,                        
  }
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>    userID          = getJSONInt(document,      "userID");      
  
      int getJSONInt(rapidjson::Document&amp; document, const char* memberName)
      {
      int memberValue;
  
      try
      {
          if (document.HasMember(memberName))
          memberValue = document[memberName].GetInt();
      }
      catch(const std::exception&amp; e)
      {
          std::cerr &lt;&lt; e.what() &lt;&lt; '\n';
      }
  
      return memberValue;
  }
  </code></pre>