Error Tracking

Error tracking is on by default (errors.enabled = true). Once the package is installed and the worker is scheduled, exceptions captured by Laravel's reporter are sent to Ranetrace.

How it hooks in

The Ranetrace facade exposes a handles() method that's wired to Laravel's exception handler. Internally, anything that flows through report() (including unhandled exceptions Laravel catches) ends up at Ranetrace::report($exception).

What gets sent

From Ranetrace\Laravel\Ranetrace::report():

  • HTTP context (when not running in console): full URL, HTTP method, and headers. Sensitive headers are masked: cookie, authorization, x-csrf-token, x-xsrf-token.
  • Console context (when running in console): the command line invocation and argv.
  • Code context: up to 11 lines from the file where the exception occurred — 5 before and 5 after — for files under 1 MB.
  • Stack trace.
  • Authenticated user (if any).
  • PHP version and Laravel version.

Reporting manually

use Ranetrace\Laravel\Facades\Ranetrace;

Ranetrace::report($exception);

report() takes a single Throwable argument — there is no second context parameter.

You can also call Laravel's built-in report() helper; it routes through the same handler:

try {
    $this->thirdPartyApi->sync();
} catch (Throwable $exception) {
    report($exception);
}

Testing your setup

php artisan ranetrace:test-errors

Configuration

From config/ranetrace.php:

'errors' => [
    'enabled' => env('RANETRACE_ERRORS_ENABLED', true),
    'queue' => env('RANETRACE_ERRORS_QUEUE', true),
    'queue_name' => env('RANETRACE_ERRORS_QUEUE_NAME', 'default'),
    'timeout' => env('RANETRACE_ERRORS_TIMEOUT', 10),
],

To disable without uninstalling:

RANETRACE_ERRORS_ENABLED=false