# Fault

`class` in `kit` · v0.1.1

<https://docs.seedcord.org/packages/kit/0.1.1/classes/fault>

A generic fault you throw after catching an error you do not have a specific message for.

The user sees a fixed generic reply with the tracking uuid, never the cause. `report` defaults to `true`, so the framework logs it and publishes it to the `handledException` bus. Pass `report: false` to show the generic reply without the bus publish. The original error is stored as the standard `cause`, so the real stack reaches the webhook. For a fault the user should see a real message, subclass [`Notice`](/packages/kit/0.1.1/classes/notice) and write your own `render` instead.

The framework also renders this for an unhandled throw, where it points the user at `ctx.developerUsername`.

```ts
class Fault extends Notice
```

## Examples

```ts
import { Fault } from '@seedcord/kit';

try {
    await db.write(record);
} catch (cause) {
    // user sees the generic reply with the uuid, the real error rides along as cause for the webhook
    throw new Fault({ cause });

    // pass report: false to show the same reply without publishing to the handledException bus
    // throw new Fault({ cause, report: false });
}
```

## Constructors

### constructor

```ts
Fault(options?: {
    cause?: unknown;
    report?: boolean;
})
```

Constructs a new instance of the `Fault` class

## Properties

### ephemeral

```ts
ephemeral: boolean;
```

Whether the reply is ephemeral, so only the invoking user sees it. Set it false for a refusal the whole channel should see.

### report

```ts
report: boolean;
```

Whether this denial is a reported fault. True also logs it and publishes it to the `handledException` bus. The user always sees [`render`](/packages/kit/0.1.1/classes/notice#render) either way.

### summary

```ts
summary: string;
```

A short one-line reason. When every arm of an `or` gate refuses and each refusal sets this, `or` lists them instead of showing a neutral message.

## Methods

### render

```ts
public render(ctx: RenderContext): ReplyResponse
```
