<!--
{
  "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

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

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

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

A general failure occurred.

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

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

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

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

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

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

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

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

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

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

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

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

[`CGError.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.

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

The requested operation was completed successfully.

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

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

## See Also

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



---

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)