# Set Stack Trace Mode for Exceptions

You can use the below API to set the stack trace mode you want to capture when reporting exceptions

{% tabs fullWidth="true" %}
{% tab title="iOS - Swift" %}

```swift
if let nonFatal = CrashReporting.report(exception) {
    nonFatal.stackTraceMode = .callerThreadOnly 
    nonFatal.report()
}
```

{% endtab %}

{% tab title="iOS - ObjC" %}

```objectivec
LCQNonFatalError *nonFatal = [LCQCrashReporting error:error];
nonFatal.stackTraceMode = LCQNonFatalStackTraceModeCallerThreadOnly
```

{% endtab %}
{% endtabs %}

Below are the different modes available:

{% tabs fullWidth="true" %}
{% tab title="iOS - Swift" %}

```swift
.full //default
.callerThreadOnly
```

{% endtab %}

{% tab title="iOS - ObjC" %}

```objectivec
LCQNonFatalStackTraceModeFull //default
LCQNonFatalStackTraceModeCallerThreadOnly
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.luciq.ai/references/crash-reporting/report-exception/set-stack-trace-mode-exceptions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
