---
title: "receivedError(_:with:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webdocumentrepresentation/receivederror(_:with:)"
---

# receivedError(_:with:)

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

## Declaration

```swift
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

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

## See Also

### Loading content

- [receivedData(_:with:)](webkit/webdocumentrepresentation/receiveddata(_:with:).md)
- [finishedLoading(with:)](webkit/webdocumentrepresentation/finishedloading(with:).md)
