<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GSS",
  "identifier" : "/documentation/GSS/GSSCreateError(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "GSS"
    ],
    "preciseIdentifier" : "c:@F@GSSCreateError"
  },
  "title" : "GSSCreateError(_:_:_:)"
}
-->

# GSSCreateError(_:_:_:)

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

```
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 [`GSS_KRB5_MECHANISM`](/documentation/GSS/GSS_KRB5_MECHANISM) for Kerberos. Use [`GSS_C_NO_OID`](/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

A <doc://com.apple.documentation/documentation/CoreFoundation/CFError> instance that corresponds to the failure described by the inputs. Release the error with <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> when you are done with it.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)