# BaseWrappedException

`com.jsmacrosce.jsmacros.core.language.BaseWrappedException`

A linked diagnostic record for an exception or stack frame.  
 The `next` links form a diagnostic chain, not a Java `Throwable` cause chain; values are stored by reference without validation or copying.  
 ```js
const Wrapped = Java.type("com.jsmacrosce.jsmacros.core.language.BaseWrappedException");  
const entry = new Wrapped("script", "diagnostic", null, null);  
Chat.log(entry.message);  
 ```

## Type Parameters

- `T`: type of the wrapped exception or stack-frame object

## Nested types

- [GuestLocation](BaseWrappedException.GuestLocation.md)
- [HostLocation](BaseWrappedException.HostLocation.md)
- [SourceLocation](BaseWrappedException.SourceLocation.md)

## Constructors

### new BaseWrappedException {#com.jsmacrosce.jsmacros.core.language.BaseWrappedException_constructor-T-String-BaseWrappedException.SourceLocation-BaseWrappedException-}

```js
new BaseWrappedException(T exception, String message, BaseWrappedException.SourceLocation location, BaseWrappedException<?> next)
```

Stores the supplied object, message, location, and next entry without copying or validation.

**Parameters:**
- `exception`: wrapped exception or stack-frame object
- `message`: diagnostic text for this entry
- `location`: source location, or `null` when unavailable
- `next`: next diagnostic entry, or `null` at the end of the chain

## Fields

### location {#com.jsmacrosce.jsmacros.core.language.BaseWrappedException_location}

```js
location: BaseWrappedException.SourceLocation
```

Source location for this entry, or `null` when unavailable.

### message {#com.jsmacrosce.jsmacros.core.language.BaseWrappedException_message}

```js
message: String
```

Diagnostic text for this entry.

### next {#com.jsmacrosce.jsmacros.core.language.BaseWrappedException_next}

```js
next: BaseWrappedException<?>
```

The next diagnostic entry, or `null` at the end of the chain.

### stackFrame {#com.jsmacrosce.jsmacros.core.language.BaseWrappedException_stackFrame}

```js
stackFrame: T
```

The supplied exception or stack-frame object.

## Methods

### wrapHostElement {#com.jsmacrosce.jsmacros.core.language.BaseWrappedException_wrapHostElement-StackTraceElement-BaseWrappedException-}

```js
static wrapHostElement(StackTraceElement t, BaseWrappedException<?> next): BaseWrappedException<StackTraceElement>
```

Wraps one host stack-frame element as a diagnostic entry linked to `next`.  
 Its message uses the unqualified class and method names; the location describes native frames, source file and line when available, or an unknown source.

**Parameters:**
- `t`: host stack-frame element
- `next`: next diagnostic entry, or `null` at the end of the chain

**Returns:** an entry containing the host frame and its display location
