lukeyouell / craft-sentry

Error tracking that helps developers monitor and fix crashes in real time. Iterate continuously. Boost efficiency. Improve user experience.
https://sentry.io
MIT License
17 stars 10 forks source link

Send an error message from a plugin #20

Open umkasanki opened 5 years ago

umkasanki commented 5 years ago

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!