craft-sentry icon indicating copy to clipboard operation
craft-sentry copied to clipboard

Send an error message from a plugin

Open umkasanki opened this issue 5 years ago • 0 comments

How can I send an error message from a plugin to Sentry? e.g.

<?php

namespace supercraft\simplicatesubscriber;

use Craft;
use craft\guestentries\controllers\SaveController;
use craft\guestentries\events\SaveEvent;
use yii\base\Event;
use lukeyouell\sentry\Sentry;

class Plugin extends \craft\base\Plugin
{

  public $hasCpSection = false;

  public function init()
  {
    parent::init();

    Event::on(SaveController::class, SaveController::EVENT_AFTER_SAVE_ENTRY, static function (SaveEvent $e) {
        ...

        if ($error) {
          
          // send error warning
          
        }
    });
  }
}

Thanks for great plugin!

umkasanki avatar May 25 '19 06:05 umkasanki