title: WKWebView get Javascript Errors
body: <p>Is there any way to get the Javascript errors from the Webview? I mean the following errors and possible warnings?</p>
  
  <p><a href="https://i.stack.imgur.com/Aqhfx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Aqhfx.png" alt="JS error"></a></p>
  
  <p>I run JS code with the following extension </p>
  
  <p>```</p>
  
  <pre><code>extension WKWebView {
      func evaluateJavaScriptWithReturn(_ javaScriptString: String) -&gt; String? {
          var finished = false
          var jsValue: String?
  
          evaluateJavaScript(javaScriptString) { (result, error) in
              if error == nil {
                  if result != nil {
                      jsValue = result as? String
                  }
              } else {
                  jsValue = nil
              }
              finished = true
          }
  
          while !finished {
              RunLoop.current.run(mode: .defaultRunLoopMode, before: Date.distantFuture)
          }
  
          return jsValue
      }
  }
  </code></pre>
  
  <p>```</p>
  
  <p>But <code>error</code> is not what i'm looking for!
  Is there any way to get in my app, the above errors?
  Thanks a lot!</p>