<?php


namespace Dan\Core;

use Dan\Events\Event;
use Illuminate\Support\ServiceProvider;

class ExceptionServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        events()->subscribe('console.exception')
            ->priority(Event::VeryHigh)
            ->handler(function (\Throwable $exception) {

                $to = formatLocation(config('dan.network_console'));
                
                $file = relativePath($exception->getFile());
                
                $to['channel']->message("Exception was thrown. {$exception->getMessage()} - On line {$exception->getLine()} of {$file}");
            });
    }
}
<?php


namespace Dan\Core;

use Dan\Events\Event;
use Illuminate\Support\ServiceProvider;

class ExceptionServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        events()->subscribe('console.exception')
            ->priority(Event::VeryHigh)
            ->handler(function (\Throwable $exception) {

                $to = formatLocation(config('dan.network_console'));
                
                $file = relativePath($exception->getFile());

                if (empty($to)) {
                    return;
                }

                $to['channel']->message("Exception was thrown. {$exception->getMessage()} - On line {$exception->getLine()} of {$file}");
            });
    }
}
Fix crashing error caused when network_console isn't accessible.
Fix crashing error caused when network_console isn't accessible.
