---
title: "CFErrorGetCode(_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cferrorgetcode(_:)"
---

# CFErrorGetCode(_:)

Returns the error code for a given CFError.

## Declaration

```swift
func CFErrorGetCode(_ err: CFError!) -> CFIndex
```

## Parameters

- `err`: The error to examine. If this is not a valid CFError, the behavior is undefined.

## Return Value

Return Value The error code of err.

## Discussion

Discussion Note that this function returns the error code for the specified CFError, not an error return for the current call.

## See Also

### Getting Information About an Error

- [CFErrorGetDomain(_:)](corefoundation/cferrorgetdomain(_:).md)
- [CFErrorCopyUserInfo(_:)](corefoundation/cferrorcopyuserinfo(_:).md)
- [CFErrorCopyDescription(_:)](corefoundation/cferrorcopydescription(_:).md)
- [CFErrorCopyFailureReason(_:)](corefoundation/cferrorcopyfailurereason(_:).md)
- [CFErrorCopyRecoverySuggestion(_:)](corefoundation/cferrorcopyrecoverysuggestion(_:).md)
