<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebDocumentRepresentation/receivedError(_:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WebDocumentRepresentation(im)receivedError:withDataSource:"
  },
  "title" : "receivedError(_:with:)"
}
-->

# receivedError(_:with:)

Invoked when a data source receives an error loading its content.

```
func receivedError(_ error: (any Error)!, with dataSource: WebDataSource!)
```

## Parameters

`error`

An `NSError` object that indicates what error occurred.

`dataSource`

A `WebDataSource` object that identifies the request that caused this error.

## Discussion

The `error` argument contains details on the error that occurred.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)