<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGError",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@E@CGError"
  },
  "title" : "CGError"
}
-->

# CGError

A uniform type for result codes returned by functions in Core Graphics.

```
enum CGError
```

## Topics

### Constants

[`case cannotComplete`](/documentation/CoreGraphics/CGError/cannotComplete)

The requested operation is inappropriate for the parameters passed in, or the current system state.

[`case failure`](/documentation/CoreGraphics/CGError/failure)

A general failure occurred.

[`case illegalArgument`](/documentation/CoreGraphics/CGError/illegalArgument)

One or more of the parameters passed to a function are invalid. Check for `NULL` pointers.

[`case invalidConnection`](/documentation/CoreGraphics/CGError/invalidConnection)

The parameter representing a connection to the window server is invalid.

[`case invalidContext`](/documentation/CoreGraphics/CGError/invalidContext)

The `CPSProcessSerNum` or context identifier parameter is not valid.

[`case invalidOperation`](/documentation/CoreGraphics/CGError/invalidOperation)

The requested operation is not valid for the parameters passed in, or the current system state.

[`case noneAvailable`](/documentation/CoreGraphics/CGError/noneAvailable)

The requested operation could not be completed as the indicated resources were not found.

[`case notImplemented`](/documentation/CoreGraphics/CGError/notImplemented)

Return value from obsolete function stubs present for binary compatibility, but not typically called.

[`case rangeCheck`](/documentation/CoreGraphics/CGError/rangeCheck)

A parameter passed in has a value that is inappropriate, or which does not map to a useful operation or value.

[`case success`](/documentation/CoreGraphics/CGError/success)

The requested operation was completed successfully.

[`case typeCheck`](/documentation/CoreGraphics/CGError/typeCheck)

A data type or token was encountered that did not match the expected type or token.

### Initializers

[`init?(rawValue: Int32)`](/documentation/CoreGraphics/CGError/init(rawValue:))

## See Also

  [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066)

## Relationships

### Conforms To

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

---

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)