> ## 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.

# XErrorSetOptions

> XErrorSetOptions

# XErrorSetOptions

게이밍 OS 또는 게이밍 런타임에서 오류가 발생할 때 원하는 동작을 지정합니다.

## 구문

```cpp theme={null}
void XErrorSetOptions(  
         XErrorOptions optionsDebuggerPresent,  
         XErrorOptions optionsDebuggerNotPresent  
)  
```

### 매개 변수

*optionsDebuggerPresent*   \_In\_\
형식: [XErrorOptions](/reference/system/xerror/enums/xerroroptions)

디버거가 연결되어 있을 때 원하는 동작을 지정합니다.

*optionsDebuggerNotPresent*   \_In\_\
형식: [XErrorOptions](/reference/system/xerror/enums/xerroroptions)

디버거가 연결되어 있지 않을 때 원하는 동작을 지정합니다.

### 반환 값

형식: void

## 설명

<Note>이 함수는 시간에 민감한 스레드에서 호출하기에 안전하지 않습니다. 자세한 내용은 [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)를 참조하세요.</Note>

게이밍 OS 또는 게이밍 런타임에서 오류가 발생할 때 게임이 반응해야 하는 방식을 지정하려면 이 함수를 사용합니다. 기본적으로 디버거가 연결되어 있지 않으면 게임은 아무 것도 하지 않으며, 디버거가 연결되어 있으면 디버거에 디버그 메시지를 출력합니다.

디버거가 연결되어 있고 *optionsDebuggerPresent*가 \[XErrorOptions::DebugBreakOnError]로 설정되어 있으면 시스템은 디버거로 중단하고 디버그 메시지를 출력합니다. 조사식 창에서 전역 변수 `XErrorDisableDebugBreak`의 값을 `true`로 설정하면 이 동작을 일시적으로 비활성화할 수 있습니다.

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

```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 콘솔

## 개념 문서

* [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 함께 보기

[XError 멤버](/reference/system/xerror/xerror_members)\
[XErrorOptions](/reference/system/xerror/enums/xerroroptions)


## Related topics

- [XErrorOptions](/ko/reference/system/xerror/enums/xerroroptions.md)
- [XErrorCallback](/ko/reference/system/xerror/functions/xerrorcallback.md)
- [XError members](/ko/reference/system/xerror/xerror_members.md)
- [XErrorSetCallback](/ko/reference/system/xerror/functions/xerrorsetcallback.md)
- [XMemSetOption](/ko/reference/system/xmem/functions/xmemsetoption.md)
