diff --git a/Model/Config/Source/Editors.php b/Model/Config/Source/Editors.php
new file mode 100644
index 0000000..05db351
--- /dev/null
+++ b/Model/Config/Source/Editors.php
@@ -0,0 +1,20 @@
+ 'Select default editor', 'value' => ''],
+ ['label' => 'phpstorm', 'value' => 'phpstorm'],
+ ['label' => 'vscode', 'value' => 'vscode'],
+ ['label' => 'sublime', 'value' => 'sublime'],
+ ['label' => 'textmate', 'value' => 'textmate'],
+ ['label' => 'emacs', 'value' => 'emacs'],
+ ['label' => 'macvim', 'value' => 'macvim'],
+ ['label' => 'idea', 'value' => 'idea'],
+ ];
+ }
+}
diff --git a/Plugin/ErrorHandler.php b/Plugin/ErrorHandler.php
new file mode 100644
index 0000000..6edd804
--- /dev/null
+++ b/Plugin/ErrorHandler.php
@@ -0,0 +1,55 @@
+appState = $appState;
+ $this->request = $request;
+ $this->scopeConfig = $scopeConfig;
+ $this->run = new \Whoops\Run;
+ }
+
+ public function beforelaunch()
+ {
+ if ($this->appState->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
+ if ($this->request->isXmlHttpRequest()) {
+ $handler = new \Whoops\Handler\JsonResponseHandler;
+ } else {
+ $handler = new \Whoops\Handler\PrettyPageHandler;
+ $editor = $this->scopeConfig->getValue('dev/debug/default_editor');
+ if ($editor) {
+ $handler->setEditor($editor);
+ }
+ }
+ $this->run->pushHandler($handler);
+ $this->run->register();
+ }
+ }
+
+ public function beforeCatchException(
+ \Magento\Framework\App\Http $subject,
+ \Magento\Framework\App\Bootstrap $bootstrap,
+ \Exception $exception
+ ) {
+ if ($this->appState->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
+ $this->run->handleException($exception);
+ }
+ }
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d0f7ea5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,11 @@
+# magento2 whoops error handler
+
+This is magento 2 module that adds Whoops error handling.
+
+ composer require --dev vaseemishak/magento2-whoops
+
+ ./bin/magento module:enable Mnm_Whoops
+ ./bin/magento setup:upgrade
+
+You can set default editor to open file with error from Whoops error page.
+ Magento admin page -> Stores -> Configuration -> Advanced -> Developer -> Debug -> Default editor for whoops
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..54b2c07
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,20 @@
+{
+ "name": "vaseemishak/magento2-whoops",
+ "type": "magento2-module",
+ "license": "OSL-3.0",
+ "description": "Magento 2 Whoops error handler",
+ "require": {
+ "magento/framework": "^100.1.0|^101.0.0|^102.0.0",
+ "filp/whoops": "^2.1",
+ "php": ">=7.0.0",
+ "symfony/var-dumper": "3.2.*"
+ },
+ "autoload": {
+ "psr-4": {
+ "Mnm\\Whoops\\": ""
+ },
+ "files": [
+ "registration.php"
+ ]
+ }
+}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
new file mode 100644
index 0000000..07ad78e
--- /dev/null
+++ b/etc/adminhtml/system.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+ Mnm\Whoops\Model\Config\Source\Editors
+
+
+
+
+
\ No newline at end of file
diff --git a/etc/config.xml b/etc/config.xml
new file mode 100644
index 0000000..db52a0f
--- /dev/null
+++ b/etc/config.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etc/di.xml b/etc/di.xml
new file mode 100644
index 0000000..7e4d8a9
--- /dev/null
+++ b/etc/di.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etc/module.xml b/etc/module.xml
new file mode 100644
index 0000000..cdbc367
--- /dev/null
+++ b/etc/module.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/registration.php b/registration.php
new file mode 100644
index 0000000..b0f1f87
--- /dev/null
+++ b/registration.php
@@ -0,0 +1,9 @@
+