Flare by Spatie
    • Error Tracking
    • Performance Monitoring
  • Pricing
  • Docs
  • Insights
  • Changelog
  • Back to Flare
  • Sign in
  • Try Flare for free
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Docs
  • Insights
  • Changelog
    • Back to Flare
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript
  • General
  • Installation
  • Framework integrations
  • Resolving bundled code
  • Errors
  • Reporting errors
  • Client hooks
  • Data Collection
  • Adding custom context
  • Adding glows
  • Solution providers

Client hooks

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

flare.beforeEvaluate

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:

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

flare.beforeSubmit

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:

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.

Reporting errors Adding custom context

Track errors and fix slowdowns with Flare, the full-stack application monitoring platform for Laravel, PHP & JavaScript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Blog
  • Changelog
  • Documentation
  • Affiliate program
  • uptime status badge Service status
  • Terms of use
  • DPA
  • Privacy & cookie Policy
Flare