Skip to content

Instantly share code, notes, and snippets.

@jules0x
Last active June 4, 2024 22:36
Show Gist options
  • Save jules0x/3212fb3a0d1d694a9d467cd782657914 to your computer and use it in GitHub Desktop.
Save jules0x/3212fb3a0d1d694a9d467cd782657914 to your computer and use it in GitHub Desktop.
raygun-error-manual
<?php
namespace App\Tasks;
use Psr\Log\LoggerInterface;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\BuildTask;
/**
* BuildTask to cause Raygun to fire. This can be used to test Slack/Raygun integration.
*/
class TestRaygun extends BuildTask
{
protected $title = '[Raygun] Test Task';
protected $description = "Used to check if Raygun is properly setup";
private static $segment = 'raygun-test';
public function run($request)
{
$testError = new \Error('[Test\] This is a test error message for raygun');
Injector::inst()->get(LoggerInterface::class)->error(
$testError->getMessage(),
['exception' => $testError]
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment