Flare by Spatie
  • Features
  • Pricing
  • Docs
  • Blog
  • LOG IN
  • START TRACKING
  • Home
  • Features
  • Pricing
  • Docs
  • Blog
    • 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

Reporting errors

Once registered using flare.light(), the @flareapp/js will automatically catch and report errors that bubble up to the window object. This includes most errors in vanilla JavaScript code that isn't wrapped in a try…catch block. Errors that are caught by, for example, Axios' catch block, will not be reported automatically. Keep on reading to find out how to send those errors to Flare too.

Reporting caught errors

You can report errors in catch statements or error boundaries using the flare.report() method:

import { flare } from "@flareapp/js";

try {
    functionThatMightThrow();
} catch (error) {
    flare.report(error);
}

Sending logs to Flare

If you don't have an error object, but you just want to send a simple log message to Flare, you can use the reportMessage method instead:

flare.reportMessage('log message');

This method has 2 optional parameters: a context object, and an exceptionClass string:

flare.reportMessage(
    'log message',
    {
        moreCustomContext: [1, 2, 3],
    },
    'CriticalLog',
);

Reporting errors caused by browser extensions

If you're using @flareapp/js version 1.1.0 or higher, Flare will ignore errors that likely caused by browser extensions. If you want to opt out of this behaviour, you may configure the JavaScript client to report them.

import { flare } from "@flareapp/js";

flare.configure({
    reportBrowserExtensionErrors: true,
});
Resolving bundled code Client hooks
  • On this page
  • Reporting caught errors
  • Sending logs to Flare
  • Reporting errors caused by browser extensions

Monitor your web apps and sites from errors to slowdowns with Flare, the easiest application monitoring platform for Laravel, PHP & Javascript.

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