# Client hooks


The `@flareapp/js` provides a couple hooks to help you finetune your integration with Flare.

## `flare.beforeEvaluate`

```typescript
beforeEvaluate: (error: Error) => Error | false | Promise<Error | false>;
```

Depending on the size of the report, submitting an error can take a second, and has a chance of slowing down your application. If you want to stop some errors from being evaluated, use the `flare.beforeEvaluate` function. If you return (a Promise returning) `false` from that function, Flare won't create or report the passed error:

```js
flare.beforeEvaluate = error => {
    if (error.message.includes('Boring error')) {
        return false;
    }
    
    return error;
};
```

## `flare.beforeSubmit`

```typescript
beforeSubmit: (report: ErrorReport) => ErrorReport | false | Promise<ErrorReport | false>
```

You can also stop a report from being sent to Flare, or edit it right before it's submitted using the `flare.beforeSubmit` function:

```js
flare.beforeSubmit = report => {
    report.stacktrace = []; // remove the stacktrace for all reports
    
    return report;
}
```

Using this hook, you can also add additional context to your error report. [Read more about customizing the report here](https://flareapp.io/docs/integration/javascript-error-tracking/adding-custom-context#customizing-the-report-before-sending).
