Flare Error tracking made for Laravel
Features Pricing Docs Blog Log in Start free trial Free trial
  • Docs
  • Videos

Documentation

  • General

    • Welcome
    • Projects
    • Errors
    • Error occurrences
    • Using the API
    • Sharing error occurrences
    • Spike protection
    • GitHub integration
  • Ignition for Laravel

    • Installation
    • Configuration
    • Security
    • Controlling collected data
    • Sending logs to Flare
    • Linking to errors
    • Identifying users
    • Adding custom context
    • Adding glows
    • Writing custom middleware
  • Flare for generic PHP projects

    • Installation
    • Controlling collected data
    • Identifying users
    • Linking to errors
    • Adding custom context
    • Adding glows
    • Writing custom middleware
  • Javascript error tracking

    • Installation
    • Framework integrations
    • Resolving Bundled Code
    • Reporting errors
    • Client hooks
    • Adding custom context
    • Adding glows
    • Solution Providers
  • Solutions

    • Introduction
    • Adding custom solutions
    • Making solutions runnable
    • Using solution providers
    • Writing good solutions
  • Notifications

    • Configuring notifications
    • Mail
    • Slack
    • Telegram
    • SMS
    • Webhooks
    • Discord
    • Microsoft Teams
  • Team management

    • Using multiple teams
    • Subscribing to a plan
    • Receiving invoices
    • Managing team members
    • Inviting guests to projects

Adding solutions

In addition to simply displaying your exception, Ignition can also display a text-based solution along with your exception message.

Screenshot of error with non runnable solution

To add a solution text to your exception, let the exception implement the Facade\IgnitionContracts\ProvidesSolution interface.

If you want to add solutions to an open source package, you can require the facade/ignition-contracts composer package. This will only provide you with the required interfaces, without actually requiring Ignition itself.

This is what that interface looks like:

namespace Facade\IgnitionContracts;

interface ProvidesSolutions
{
    public function getSolution(): Solution;
}

The getSolution method expects you to return an implementation of the Solution interface. You can either create a custom class that implements that interface or make use of the built-in BaseSolution class to easily return a textual solution.

Here's an example of an implementation in a custom exception class:

namespace App\Exceptions;

use Exception;
use Facade\IgnitionContracts\Solution;
use Facade\IgnitionContracts\BaseSolution;
use Facade\IgnitionContracts\ProvidesSolution;

class MyException extends Exception implements ProvidesSolution
{
    public function getSolution(): Solution
    {
        return BaseSolution::create('My solution title')
            ->setSolutionDescription('My solution description')
            ->setDocumentationLinks([
                'My docs' => 'https://flareapp.io/docs',
            ]);
    }
}

This is how the exception would be displayed if you were to throw it.

Screenshot of exception with solution in Ignition

If you're sending your exception to Flare, the solution will be sent along as well. Here's how the exception above would look like in Flare.

Screenshot of exception with solution in Flare

Previous topic Next topic

About Flare

  • Home
  • Features
  • Pricing
  • Support

Resources

  • Blog
  • Changelog
  • Docs
  • Ignition

App

  • Log in
  • Start free trial
SPATIE
  • Service status
  • Terms of use
  • Privacy & cookie policy