This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
app/code/Magento/NewRelicReporting Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \NewRelicReporting \Model \Observer ;
7
+
8
+ use Magento \Framework \Event \Observer ;
9
+ use Magento \Framework \Event \ObserverInterface ;
10
+ use Magento \NewRelicReporting \Model \Config ;
11
+ use Magento \NewRelicReporting \Model \NewRelicWrapper ;
12
+
13
+ /**
14
+ * Class ReportApplicationHandledExceptionToNewRelic
15
+ */
16
+ class ReportApplicationHandledExceptionToNewRelic implements ObserverInterface
17
+ {
18
+ /**
19
+ * @var Config
20
+ */
21
+ protected $ config ;
22
+
23
+ /**
24
+ * @var NewRelicWrapper
25
+ */
26
+ protected $ newRelicWrapper ;
27
+
28
+ /**
29
+ * @param Config $config
30
+ * @param NewRelicWrapper $newRelicWrapper
31
+ */
32
+ public function __construct (
33
+ Config $ config ,
34
+ NewRelicWrapper $ newRelicWrapper
35
+ ) {
36
+ $ this ->config = $ config ;
37
+ $ this ->newRelicWrapper = $ newRelicWrapper ;
38
+ }
39
+
40
+ public function execute (Observer $ observer )
41
+ {
42
+ if ($ this ->config ->isNewRelicEnabled ()) {
43
+ $ exception = $ observer ->getEvent ()->getException ();
44
+ $ this ->newRelicWrapper ->reportError ($ exception );
45
+ }
46
+ }
47
+ }
Original file line number Diff line number Diff line change 10
10
<observer name =" newrelicreporting_observer_report_sales_order_place" instance =" Magento\NewRelicReporting\Model\Observer\ReportOrderPlaced" />
11
11
<observer name =" newrelicreporting_newrelic_report_sales_order_place" instance =" Magento\NewRelicReporting\Model\Observer\ReportOrderPlacedToNewRelic" />
12
12
</event >
13
+ <event name =" application_handled_exception" >
14
+ <observer name =" newrelicreporting_newrelic_report_application_handled_exception" instance =" Magento\NewRelicReporting\Model\Observer\ReportApplicationHandledExceptionToNewRelic" />
15
+ </event >
13
16
</config >
You can’t perform that action at this time.
0 commit comments