---
title: "dataCorruptedError(forKey:in:debugDescription:)"
framework: swift
role: symbol
role_heading: Type Method
path: "swift/decodingerror/datacorruptederror(forkey:in:debugdescription:)"
---

# dataCorruptedError(forKey:in:debugDescription:)

Returns a new .dataCorrupted error using a constructed coding path and the given debug description.

## Declaration

```swift
static func dataCorruptedError<C>(forKey key: C.Key, in container: C, debugDescription: String) -> DecodingError where C : KeyedDecodingContainerProtocol
```

## Return Value

Return Value A new .dataCorrupted error with the given information.

## Discussion

Discussion The coding path for the returned error is constructed by appending the given key to the given container’s coding path. param key: The key which caused the failure. param container: The container in which the corrupted data was accessed. param debugDescription: A description of the error to aid in debugging.
