-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from webrgp/feature/bootable-extension
Auto replace default Error Handler
- Loading branch information
Showing
5 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace webrgp\ignition; | ||
|
||
use craft\console\Application as CraftConsoleApp; | ||
use craft\web\Application as CraftWebApp; | ||
use webrgp\ignition\web\IgnitionErrorHandler; | ||
use yii\base\BootstrapInterface; | ||
|
||
class Ignition implements BootstrapInterface | ||
{ | ||
/** | ||
* Bootstraps the application by registering the Ignition error handler. | ||
* | ||
* @param \yii\base\Application $app The application instance. | ||
* | ||
* Only bootstraps if the application is an instance of CraftWebApp or CraftConsoleApp. | ||
* Registers the Ignition error handler and sets it to the application's errorHandler component. | ||
*/ | ||
public function bootstrap($app) | ||
{ | ||
// Only bootstrap if this is a CraftWebApp | ||
if (!($app instanceof CraftWebApp || $app instanceof CraftConsoleApp)) { | ||
return; | ||
} | ||
|
||
// Register the Ignition error handler | ||
$app->set('errorHandler', [ | ||
'class' => IgnitionErrorHandler::class, | ||
]); | ||
|
||
$errorHandler = $app->getErrorHandler(); | ||
|
||
$errorHandler->register(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters