---
title: SCCopyLastError()
framework: systemconfiguration
role: symbol
role_heading: Function
path: systemconfiguration/sccopylasterror()
---

# SCCopyLastError()

Returns an error or status code associated with the most recent function call.

## Declaration

```swift
func SCCopyLastError() -> CFError
```

## Return Value

Return Value The most recent status or error code generated as the result of calling a function defined by the System Configuration framework. The code is represented by a Core Foundation CFErrorRef opaque type.

## Discussion

Discussion Call the CFErrorGetCode(_:) function on the returned object to get the underlying error-code integer. See Status and Error Codes for descriptions of these codes. For more on CFErrorRef objects, see CFError.

## See Also

### Functions

- [SCError()](systemconfiguration/scerror().md)
- [SCErrorString(_:)](systemconfiguration/scerrorstring(_:).md)
