Skip to main content

XErrorSetCallback

Specifies the callback that is called when an error occurs in the gaming OS or gaming runtime.

Syntax

Parameters

callback   _In_
Type: XErrorCallback*
Pointer to the game-defined callback to call. Passing in nullptr clears the callback. context   _In_
Type: void*
Context pointer for the callback.

Return value

Type: void

Remarks

This function isn’t safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.
Use this function to specify the XErrorCallback callback in your game that the system should call if an error occurs, and the XErrorSetOptions function to specify how the game should behave when an error occurs in the gaming OS or gaming runtime. The following example illustrates how to set error options, define a custom error callback, and set the custom error callback to receive error notifications by the system.

Requirements

Header: XError.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

Conceptual documentation

See also

XError members
XErrorCallback
Last modified on August 20, 2026