---
title: "download(_:didFailWithError:resumeData:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkdownloaddelegate/download(_:didfailwitherror:resumedata:)"
---

# download(_:didFailWithError:resumeData:)

Tells the delegate that the download failed, with error information and data you can use to restart the download.

## Declaration

```swift
optional func download(_ download: WKDownload, didFailWithError error: any Error, resumeData: Data?)
```

## Parameters

- `download`: The download that failed.
- `error`: An error describing what caused the download to fail.
- `resumeData`: A data object you use to restart the download.

## Discussion

Discussion To restart a failed download, call resumeDownload(fromResumeData:completionHandler:) with resumeData.

## See Also

### Tracking Download Progress

- [download(_:decideDestinationUsing:suggestedFilename:completionHandler:)](webkit/wkdownloaddelegate/download(_:decidedestinationusing:suggestedfilename:completionhandler:).md)
- [downloadDidFinish(_:)](webkit/wkdownloaddelegate/downloaddidfinish(_:).md)
