---
title: "GSSCreateError(_:_:_:)"
framework: GSS
role: symbol
role_heading: Function
platforms: [iOS 8.0+, iPadOS 8.0+, Mac Catalyst 13.1+, macOS 10.10+, visionOS 1.0+]
path: "gss/gsscreateerror(_:_:_:)"
---

# GSSCreateError(_:_:_:)

Returns an error object based on GSS-API major and minor status codes.

## Declaration

```swift
func GSSCreateError(_ mech: gss_const_OID, _ major_status: OM_uint32, _ minor_status: OM_uint32) -> Unmanaged<CFError>?
```

## Parameters

- `mech`: The underlying mechanism in use. For example, use doc://com.apple.gss/documentation/GSS/GSS_KRB5_MECHANISM for Kerberos. Use doc://com.apple.gss/documentation/GSS/GSS_C_NO_OID if none is available.
- `major_status`: Major status code from a failed GSS-API function call.
- `minor_status`: Minor status code from a failed GSS-API function call.

## Return Value

Return Value A CFError instance that corresponds to the failure described by the inputs. Release the error with CFRelease when you are done with it.

## See Also

### Status and Error Creation

- [OM_uint32](gss/om_uint32.md)
- [OM_uint64](gss/om_uint64.md)
- [gss_uint32](gss/gss_uint32.md)
- [gss_status_id_t](gss/gss_status_id_t.md)
- [GSS_C_MECH_CODE](gss/gss_c_mech_code.md)
- [GSS_C_GSS_CODE](gss/gss_c_gss_code.md)
- [GSS_S_COMPLETE](gss/gss_s_complete.md)
- [gss_display_status(_:_:_:_:_:_:)](gss/gss_display_status(_:_:_:_:_:_:).md)
