> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XErrorCallback

> XErrorCallback

# XErrorCallback

게이밍 OS 또는 게이밍 런타임에서 오류가 발생하면 호출되는 콜백입니다.

## 구문

```cpp theme={null}
bool XErrorCallback(  
         HRESULT hr,  
         const char* msg,  
         void* context  
)  
```

### 매개 변수

*hr*   \_In\_\
형식: HRESULT

오류와 관련된 HRESULT 코드입니다.

*msg*   \_In\_z\_\
형식: char\*

오류에 대한 텍스트 설명입니다.

*context*   \_In\_\
형식: void\*

콜백에 대한 컨텍스트 포인터입니다.

### 반환 값

형식: bool

시스템이 계속 진행하여 [XErrorSetOptions](/reference/system/xerror/functions/xerrorsetoptions)에 지정된 동작을 수행하도록 하려면 `true`를 반환하고, 오류를 무시하려면 `false`를 반환합니다.

## 설명

게임에서 오류가 발생할 경우 시스템이 호출해야 하는 `XErrorCallback` 콜백을 지정하려면 [XErrorSetCallback](/reference/system/xerror/functions/xerrorsetcallback) 함수를 사용하고, 게이밍 OS 또는 게이밍 런타임에서 오류가 발생할 때 게임이 동작하는 방식을 지정하려면 `XErrorSetOptions` 함수를 사용합니다.

다음 예제는 오류 옵션을 설정하고, 사용자 지정 오류 콜백을 정의하고, 시스템에서 오류 알림을 수신하도록 사용자 지정 오류 콜백을 설정하는 방법을 보여 줍니다.

```cpp theme={null}
bool CustomGameXErrorCallback(_In_ HRESULT hr, _In_ const char* msg, _In_ void* context)  
{  
   // Capture the error to the game's custom logger  
   CustomGameLogger* logger = (CustomGameLogger*)context;  
   logger->ReportGameRuntimeIssue(hr, msg);  
  
   // Don't ignore the error. For example, continue on and do whatever  
   // is specified by XErrorSetOptions().  
   return true;  
}  
  
void SomeGameFunction()  
{  
   // Previously initialize the game's custom logger  
   // CustomGameLogger* m_logger = InitializeLogger();  
   // ...  
  
   // Setup how you want to handle XErrors  
   XErrorSetOptions(DebugBreakOnError, FailFastOnError);
   XErrorSetCallback(CustomGameXErrorCallback, m_logger);
}  
```

## 요구 사항

**헤더:** XError.h

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[XError 멤버](/reference/system/xerror/xerror_members)\
[XErrorSetCallback](/reference/system/xerror/functions/xerrorsetcallback)


## Related topics

- [XErrorSetCallback](/ko/reference/system/xerror/functions/xerrorsetcallback.md)
- [XError members](/ko/reference/system/xerror/xerror_members.md)
- [XMemCreateWin32Heap](/ko/reference/system/xmem/functions/xmemcreatewin32heap.md)
- [WdCopyErrorCallback](/ko/reference/remoting/callbacks/wdcopyerrorcallback.md)
- [XtfDebugStringErrorCallback](/ko/reference/tools/xtf/xtfapi/functions/xtfdebugstringerrorcallback-xtfapi-xbox-windows-m.md)
