title: How to detect errors only from the main page in new onReceivedError from WebViewClient
body: <h3>Context</h3>
  
  <p>In the Android SDK 23 <code>onReceivedError(WebView view, int errorCode, String description, String failingUrl)</code> has been deprecated and replaced with <code>onReceivedError(WebView view, WebResourceRequest request, WebResourceError error)</code>. However as per <a href="https://developer.android.com/reference/android/webkit/WebViewClient.html#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError)" rel="noreferrer">documentation</a>:</p>
  
  <blockquote>
    <p>Note that unlike the deprecated version of the callback, the new
    version will be called for any resource (iframe, image, etc), not just
    for the main page</p>
  </blockquote>
  
  <h3>Problem</h3>
  
  <p>We have an app where in the deprecated <code>onReceivedError</code> method there is a code to display a native view instead of letting the user see the error in the WebView.</p>
  
  <p>We would like to replace the deprecated <code>onReceivedError</code> method by the new method. But we don't want to display the native view for errors for any resource, just for the main page.</p>
  
  <h3>Question</h3>
  
  <p>How can we identify in the new <code>onReceivedError</code> that the error is not from the main page?</p>
  
  <p>PS 1: We would prefer not having a solution like <a href="https://stackoverflow.com/a/43664365/1401164">this</a> to store the main url and check it against the failing url.</p>
  
  <p>PS 2: If the solution is to just use the deprecated method, what's the guarantee that it will still be called for new Android versions?</p>