mirror of
https://github.com/filp/whoops.git
synced 2026-08-17 15:50:59 +00:00
Update code-base to 'Whoops'
This commit is contained in:
@@ -1,22 +1,13 @@
|
||||
# HEY!
|
||||
|
||||
**damnit**'s name will be changed to **whoops** today, to resolve concerns about possible issues with the library's name.
|
||||
If you're using this library, and find things stop working all of a sudden, please update to the new name!
|
||||
|
||||
- The repository will be renamed to: `filp/whoops`
|
||||
- The composer library will be renamed to `filp/whoops`
|
||||
- The top namespace for the library will be renamed to `Whoops`
|
||||
|
||||
# damnit
|
||||
# whoops
|
||||
php errors for cool kids
|
||||
|
||||
[](https://travis-ci.org/filp/damnit)
|
||||
[](https://travis-ci.org/filp/whoops)
|
||||
|
||||
-----
|
||||
|
||||

|
||||

|
||||
|
||||
**damnit** is an error handler base/framework for PHP. Out-of-the-box, it provides a pretty
|
||||
**whoops** is an error handler base/framework for PHP. Out-of-the-box, it provides a pretty
|
||||
error interface that helps you debug your web projects, but at heart it's a simple yet
|
||||
powerful stacked error handling system.
|
||||
|
||||
@@ -28,8 +19,8 @@ This library is currently in a **heavy development phase, and may catch on fire
|
||||
- Stand-alone library with (currently) no required dependencies
|
||||
- Simple API for dealing with exceptions, trace frames & their data
|
||||
- Includes a pretty rad error page for your webapp projects
|
||||
- Includes a `Silex\DamnitServiceProvider` for painless integration with [Silex](http://silex.sensiolabs.org/)
|
||||
- Includes an `Illuminate\DamnitServiceProvider` for equally painless integration with [Laravel 4](http://laravel.com/)
|
||||
- Includes a `Silex\WhoopsServiceProvider` for painless integration with [Silex](http://silex.sensiolabs.org/)
|
||||
- Includes an `Illuminate\WhoopsServiceProvider` for equally painless integration with [Laravel 4](http://laravel.com/)
|
||||
- Easy to extend and integrate with existing libraries
|
||||
- Clean, well-structured & tested code-base (well, except `pretty-template.php`, for now...)
|
||||
|
||||
@@ -38,12 +29,12 @@ This library is currently in a **heavy development phase, and may catch on fire
|
||||
- Install [Composer](http://getcomposer.org) and place the executable somewhere in your `$PATH` (for the rest of this README,
|
||||
I'll reference it as just `composer`)
|
||||
|
||||
- Add `filp/damnit` to your project's `composer.json:
|
||||
- Add `filp/whoops` to your project's `composer.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"filp/damnit": "dev-master"
|
||||
"filp/whoops": "dev-master"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -60,7 +51,7 @@ I promise it's really simple!
|
||||
|
||||
## Integrating with Silex
|
||||
|
||||
**damnit** comes packaged with a Silex Service Provider: `Damnit\Provider\Silex\DamnitServiceProvider`. Using it
|
||||
**whoops** comes packaged with a Silex Service Provider: `Whoops\Provider\Silex\WhoopsServiceProvider`. Using it
|
||||
in your existing Silex project is easy:
|
||||
|
||||
```php
|
||||
@@ -72,7 +63,7 @@ use Silex\Application;
|
||||
// ... some awesome code here ...
|
||||
|
||||
if($app['debug']) {
|
||||
$app->register(new Damnit\Provider\Silex\DamnitServiceProvider);
|
||||
$app->register(new Whoops\Provider\Silex\WhoopsServiceProvider);
|
||||
}
|
||||
|
||||
// ...
|
||||
@@ -81,19 +72,19 @@ $app->run();
|
||||
```
|
||||
|
||||
And that's about it. By default, you'll get the pretty error pages if something goes awry in your development
|
||||
environment, but you also have full access to the **damnit** library, obviously. For example, adding a new handler
|
||||
into your app is as simple as extending `damnit`:
|
||||
environment, but you also have full access to the **whoops** library, obviously. For example, adding a new handler
|
||||
into your app is as simple as extending `whoops`:
|
||||
|
||||
```php
|
||||
$app['damnit'] = $app->extend('damnit', function($damnit) {
|
||||
$damnit->pushHandler(new DeleteWholeProjectHandler);
|
||||
return $damnit;
|
||||
$app['whoops'] = $app->extend('whoops', function($whoops) {
|
||||
$whoops->pushHandler(new DeleteWholeProjectHandler);
|
||||
return $whoops;
|
||||
});
|
||||
```
|
||||
|
||||
## Integrating with Laravel 3
|
||||
|
||||
User [@hdias](https://github.com/hdias) contributed a simple guide/example to help you integrate **damnit** with Laravel 3's IoC container, available at:
|
||||
User [@hdias](https://github.com/hdias) contributed a simple guide/example to help you integrate **whoops** with Laravel 3's IoC container, available at:
|
||||
|
||||
https://gist.github.com/hdias/5169713#file-start-php
|
||||
|
||||
@@ -102,18 +93,18 @@ https://gist.github.com/hdias/5169713#file-start-php
|
||||
User [@schickling](https://github.com/schickling) contributed a service provider for Laravel 4. Just include this in your app/config/app.php in the "providers" array:
|
||||
|
||||
```php
|
||||
'Damnit\Provider\Illuminate\DamnitServiceProvider'
|
||||
'Whoops\Provider\Illuminate\WhoopsServiceProvider'
|
||||
```
|
||||
|
||||
Alternatively, [@dberry37388](https://github.com/dberry37388)'s [laravel4-support](https://github.com/dberry37388/laravel4-support) package also integrates **damnit** into your fancy-schmancy Laravel stack.
|
||||
Alternatively, [@dberry37388](https://github.com/dberry37388)'s [laravel4-support](https://github.com/dberry37388/laravel4-support) package also integrates **whoops** into your fancy-schmancy Laravel stack.
|
||||
|
||||
## Available Handlers
|
||||
|
||||
**damnit** currently ships with the following built-in handlers, available in the `Damnit\Handler` namespace:
|
||||
**whoops** currently ships with the following built-in handlers, available in the `Whoops\Handler` namespace:
|
||||
|
||||
- [`PrettyPageHandler`](https://github.com/filp/damnit/blob/master/src/Damnit/Handler/PrettyPageHandler.php) - Shows a pretty error page when something goes pants-up
|
||||
- [`CallbackHandler`](https://github.com/filp/damnit/blob/master/src/Damnit/Handler/CallbackHandler.php) - Wraps a closure or other callable as a handler. You do not need to use this handler explicitly, **damnit** will automatically wrap any closure or callable you pass to `Damnit\Run::pushHandler`
|
||||
- [`JsonResponseHandler`](https://github.com/filp/damnit/blob/master/src/Damnit/Handler/JsonResponseHandler.php) - Captures exceptions and returns information on them as a JSON string. Can be used to, for example, play nice with AJAX requests.
|
||||
- [`PrettyPageHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/PrettyPageHandler.php) - Shows a pretty error page when something goes pants-up
|
||||
- [`CallbackHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/CallbackHandler.php) - Wraps a closure or other callable as a handler. You do not need to use this handler explicitly, **whoops** will automatically wrap any closure or callable you pass to `Whoops\Run::pushHandler`
|
||||
- [`JsonResponseHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/JsonResponseHandler.php) - Captures exceptions and returns information on them as a JSON string. Can be used to, for example, play nice with AJAX requests.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -122,8 +113,8 @@ If you want to help, great! Here's a couple of steps/guidelines:
|
||||
- Fork/clone this repo, and update dev dependencies using Composer
|
||||
|
||||
```bash
|
||||
$ git clone git@github.com:filp/damnit.git
|
||||
$ cd damnit
|
||||
$ git clone git@github.com:filp/whoops.git
|
||||
$ cd whoops
|
||||
$ composer install --dev
|
||||
```
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "filp/damnit",
|
||||
"name": "filp/whoops",
|
||||
"license": "MIT",
|
||||
"description": "php error handling for cool kids",
|
||||
"version": "0.8.4",
|
||||
"keywords": ["library", "error", "handling", "exception", "silex-provider", "damnit"],
|
||||
"homepage": "https://github.com/filp/damnit",
|
||||
"keywords": ["library", "error", "handling", "exception", "silex-provider", "whoops"],
|
||||
"homepage": "https://github.com/filp/whoops",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Filipe Dobreira",
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Damnit": "src/"
|
||||
"Whoops": "src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*
|
||||
* NOTE: Requires silex/silex, can be installed with composer
|
||||
@@ -19,14 +19,14 @@
|
||||
*/
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use Damnit\Provider\Silex\DamnitServiceProvider;
|
||||
use Whoops\Provider\Silex\WhoopsServiceProvider;
|
||||
use Silex\Application;
|
||||
|
||||
$app = new Application;
|
||||
$app['debug'] = true;
|
||||
|
||||
if($app['debug']) {
|
||||
$app->register(new DamnitServiceProvider);
|
||||
$app->register(new WhoopsServiceProvider);
|
||||
}
|
||||
|
||||
$app->get('/', function() use($app) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*
|
||||
* Run this example file with the PHP 5.4 web server with:
|
||||
@@ -13,9 +13,9 @@
|
||||
* Or just run it through apache/nginx/what-have-yous as usual.
|
||||
*/
|
||||
|
||||
namespace Damnit\Example;
|
||||
use Damnit\Run;
|
||||
use Damnit\Handler\PrettyPageHandler;
|
||||
namespace Whoops\Example;
|
||||
use Whoops\Run;
|
||||
use Whoops\Handler\PrettyPageHandler;
|
||||
use Exception as BaseException;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
+3
-3
@@ -2,14 +2,14 @@
|
||||
|
||||
<phpunit bootstrap="tests/bootstrap.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="Damnit Tests Suite">
|
||||
<directory>tests/Damnit/</directory>
|
||||
<testsuite name="Whoops Tests Suite">
|
||||
<directory>tests/Whoops/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src/Damnit/</directory>
|
||||
<directory suffix=".php">src/Whoops/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Exception;
|
||||
namespace Whoops\Exception;
|
||||
use ErrorException as BaseErrorException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Exception;
|
||||
namespace Whoops\Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Frame
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Exception;
|
||||
use Damnit\Exception\Frame;
|
||||
namespace Whoops\Exception;
|
||||
use Whoops\Exception\Frame;
|
||||
use Iterator;
|
||||
use Countable;
|
||||
|
||||
@@ -22,7 +22,7 @@ class FrameIterator implements Iterator, Countable
|
||||
private $frames;
|
||||
|
||||
/**
|
||||
* @return Damnit\Exception\Frame|false
|
||||
* @return Whoops\Exception\Frame|false
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Exception;
|
||||
use Damnit\Exception\FrameIterator;
|
||||
use Damnit\Exception\ErrorException;
|
||||
namespace Whoops\Exception;
|
||||
use Whoops\Exception\FrameIterator;
|
||||
use Whoops\Exception\ErrorException;
|
||||
use Exception;
|
||||
|
||||
class Inspector
|
||||
@@ -17,7 +17,7 @@ class Inspector
|
||||
private $exception;
|
||||
|
||||
/**
|
||||
* @var Damnit\Exception\FrameIterator
|
||||
* @var Whoops\Exception\FrameIterator
|
||||
*/
|
||||
private $framesIterator;
|
||||
|
||||
@@ -63,7 +63,7 @@ class Inspector
|
||||
if($this->framesIterator === null) {
|
||||
$frames = $this->exception->getTrace();
|
||||
|
||||
// If we're handling an ErrorException thrown by Damnit,
|
||||
// If we're handling an ErrorException thrown by Whoops,
|
||||
// get rid of the last, which matches the handleError method,
|
||||
// and do not add the current exception to trace
|
||||
if($this->exception instanceof ErrorException) {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Handler;
|
||||
use Damnit\Handler\Handler;
|
||||
namespace Whoops\Handler;
|
||||
use Whoops\Handler\Handler;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Wrapper for Closures passed as handlers. Can be used
|
||||
* directly, or will be instantiated automagically by Damnit\Run
|
||||
* directly, or will be instantiated automagically by Whoops\Run
|
||||
* if passed to Run::pushHandler
|
||||
*/
|
||||
class CallbackHandler extends Handler
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Handler;
|
||||
use Damnit\Handler\HandlerInterface;
|
||||
use Damnit\Exception\Inspector;
|
||||
use Damnit\Run;
|
||||
namespace Whoops\Handler;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\Run;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
@@ -25,12 +25,12 @@ abstract class Handler implements HandlerInterface
|
||||
const QUIT = 0x30;
|
||||
|
||||
/**
|
||||
* @var Damnit\Run
|
||||
* @var Whoops\Run
|
||||
*/
|
||||
private $run;
|
||||
|
||||
/**
|
||||
* @var Damnit\Exception\Inspector $inspector
|
||||
* @var Whoops\Exception\Inspector $inspector
|
||||
*/
|
||||
private $inspector;
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class Handler implements HandlerInterface
|
||||
private $exception;
|
||||
|
||||
/**
|
||||
* @param Damnit\Run $run
|
||||
* @param Whoops\Run $run
|
||||
*/
|
||||
public function setRun(Run $run)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ abstract class Handler implements HandlerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Damnit\Run
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
protected function getRun()
|
||||
{
|
||||
@@ -56,7 +56,7 @@ abstract class Handler implements HandlerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Damnit\Exception\Inspector $inspector
|
||||
* @param Whoops\Exception\Inspector $inspector
|
||||
*/
|
||||
public function setInspector(Inspector $inspector)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ abstract class Handler implements HandlerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Damnit\Run
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
protected function getInspector()
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Handler;
|
||||
use Damnit\Exception\Inspector;
|
||||
use Damnit\Run;
|
||||
namespace Whoops\Handler;
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\Run;
|
||||
use Exception;
|
||||
|
||||
interface HandlerInterface
|
||||
@@ -17,7 +17,7 @@ interface HandlerInterface
|
||||
public function handle();
|
||||
|
||||
/**
|
||||
* @param Damnit\Run $run
|
||||
* @param Whoops\Run $run
|
||||
*/
|
||||
public function setRun(Run $run);
|
||||
|
||||
@@ -27,7 +27,7 @@ interface HandlerInterface
|
||||
public function setException(Exception $exception);
|
||||
|
||||
/**
|
||||
* @param Damnit\Exception\Inspector $run
|
||||
* @param Whoops\Exception\Inspector $run
|
||||
*/
|
||||
public function setInspector(Inspector $run);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Handler;
|
||||
use Damnit\Handler\Handler;
|
||||
namespace Whoops\Handler;
|
||||
use Whoops\Handler\Handler;
|
||||
|
||||
/**
|
||||
* Catches an exception and converts it to a JSON
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Handler;
|
||||
use Damnit\Handler\Handler;
|
||||
namespace Whoops\Handler;
|
||||
use Whoops\Handler\Handler;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class PrettyPageHandler extends Handler
|
||||
@@ -96,7 +96,7 @@ class PrettyPageHandler extends Handler
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the `damnit` branding be visible in the top-right corner?
|
||||
* Should the `whoops` branding be visible in the top-right corner?
|
||||
* @param bool $showBranding
|
||||
*/
|
||||
public function showBranding($showBranding = true)
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <https://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Provider\Illuminate;
|
||||
use Damnit\Handler\PrettyPageHandler;
|
||||
use Damnit\Run;
|
||||
namespace Whoops\Provider\Illuminate;
|
||||
use Whoops\Handler\PrettyPageHandler;
|
||||
use Whoops\Run;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* Provides support for Illuminate (Laravel 4)
|
||||
* @author schickling <https://github.com/schickling>
|
||||
*/
|
||||
class DamnitServiceProvider extends ServiceProvider {
|
||||
class WhoopsServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Register the service provider for damnit to laravel
|
||||
* Register the service provider for whoops to laravel
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$app = $this->app;
|
||||
|
||||
$app['damnit.handler'] = $app->share(function($app) {
|
||||
$app['whoops.handler'] = $app->share(function($app) {
|
||||
return new PrettyPageHandler;
|
||||
});
|
||||
|
||||
$app['damnit'] = $app->share(function($app) {
|
||||
$app['whoops'] = $app->share(function($app) {
|
||||
$run = new Run;
|
||||
|
||||
return $run->pushHandler($app['damnit.handler']);
|
||||
return $run->pushHandler($app['whoops.handler']);
|
||||
});
|
||||
|
||||
$app->error(function($e) use ($app) {
|
||||
$app['damnit']->handleException($e);
|
||||
$app['whoops']->handleException($e);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Provider\Silex;
|
||||
use Damnit\Run;
|
||||
use Damnit\Handler\PrettyPageHandler;
|
||||
namespace Whoops\Provider\Silex;
|
||||
use Whoops\Run;
|
||||
use Whoops\Handler\PrettyPageHandler;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Silex\Application;
|
||||
|
||||
class DamnitServiceProvider implements ServiceProviderInterface
|
||||
class WhoopsServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* @see Silex\ServiceProviderInterface::register
|
||||
@@ -19,7 +19,7 @@ class DamnitServiceProvider implements ServiceProviderInterface
|
||||
public function register(Application $app)
|
||||
{
|
||||
// There's only ever going to be one error page...right?
|
||||
$app['damnit.error_page_handler'] = $app->share(function() {
|
||||
$app['whoops.error_page_handler'] = $app->share(function() {
|
||||
return new PrettyPageHandler;
|
||||
});
|
||||
|
||||
@@ -28,11 +28,11 @@ class DamnitServiceProvider implements ServiceProviderInterface
|
||||
// This works by adding a new handler to the stack that runs
|
||||
// before the error page, retrieving the shared page handler
|
||||
// instance, and working with it to add new data tables
|
||||
$app['damnit.silex_info_handler'] = $app->protect(function() use($app) {
|
||||
$app['whoops.silex_info_handler'] = $app->protect(function() use($app) {
|
||||
$request = $app['request'];
|
||||
|
||||
// General application info:
|
||||
$app['damnit.error_page_handler']->addDataTable('Silex Application', array(
|
||||
$app['whoops.error_page_handler']->addDataTable('Silex Application', array(
|
||||
'Charset' => $app['charset'],
|
||||
'Locale' => $app['locale'],
|
||||
'Route Class' => $app['route_class'],
|
||||
@@ -41,7 +41,7 @@ class DamnitServiceProvider implements ServiceProviderInterface
|
||||
));
|
||||
|
||||
// Request info:
|
||||
$app['damnit.error_page_handler']->addDataTable('Silex Application (Request)', array(
|
||||
$app['whoops.error_page_handler']->addDataTable('Silex Application (Request)', array(
|
||||
'URI' => $request->getUri(),
|
||||
'Request URI' => $request->getRequestUri(),
|
||||
'Path Info' => $request->getPathInfo(),
|
||||
@@ -56,15 +56,15 @@ class DamnitServiceProvider implements ServiceProviderInterface
|
||||
));
|
||||
});
|
||||
|
||||
$app['damnit'] = $app->share(function() use($app) {
|
||||
$app['whoops'] = $app->share(function() use($app) {
|
||||
$run = new Run;
|
||||
$run->pushHandler($app['damnit.error_page_handler']);
|
||||
$run->pushHandler($app['damnit.silex_info_handler']);
|
||||
$run->pushHandler($app['whoops.error_page_handler']);
|
||||
$run->pushHandler($app['whoops.silex_info_handler']);
|
||||
return $run;
|
||||
});
|
||||
|
||||
$app->error(array($app['damnit'], Run::EXCEPTION_HANDLER));
|
||||
$app['damnit']->register();
|
||||
$app->error(array($app['whoops'], Run::EXCEPTION_HANDLER));
|
||||
$app['whoops']->register();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Template file for Damnit's pretty error output.
|
||||
* Template file for Whoops's pretty error output.
|
||||
* Check the $v global variable (stdClass) for what's available
|
||||
* to work with.
|
||||
* @var $v
|
||||
|
||||
+18
-18
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit;
|
||||
use Damnit\Handler\HandlerInterface;
|
||||
use Damnit\Handler\Handler;
|
||||
use Damnit\Handler\CallbackHandler;
|
||||
use Damnit\Exception\Inspector;
|
||||
use Damnit\Exception\ErrorException;
|
||||
namespace Whoops;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
use Whoops\Handler\Handler;
|
||||
use Whoops\Handler\CallbackHandler;
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\Exception\ErrorException;
|
||||
use InvalidArgumentException;
|
||||
use Exception;
|
||||
|
||||
@@ -29,8 +29,8 @@ class Run
|
||||
|
||||
/**
|
||||
* Pushes a handler to the end of the stack.
|
||||
* @param Damnit\HandlerInterface $handler
|
||||
* @return Damnit\Run
|
||||
* @param Whoops\HandlerInterface $handler
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
public function pushHandler($handler)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ class Run
|
||||
if(!$handler instanceof HandlerInterface) {
|
||||
throw new InvalidArgumentException(
|
||||
'Argument to ' . __METHOD__ . ' must be a callable, or instance of'
|
||||
. 'Damnit\\Handler\\HandlerInterface'
|
||||
. 'Whoops\\Handler\\HandlerInterface'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class Run
|
||||
/**
|
||||
* Removes the last handler in the stack and returns it.
|
||||
* Returns null if there's nothing else to pop.
|
||||
* @return null|Damnit\Handler\HandlerInterface
|
||||
* @return null|Whoops\Handler\HandlerInterface
|
||||
*/
|
||||
public function popHandler()
|
||||
{
|
||||
@@ -72,7 +72,7 @@ class Run
|
||||
/**
|
||||
* Clears all handlers in the handlerStack, including
|
||||
* the default PrettyPage handler.
|
||||
* @return Damnit\Run
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
public function clearHandlers()
|
||||
{
|
||||
@@ -82,7 +82,7 @@ class Run
|
||||
|
||||
/**
|
||||
* @param Exception $exception
|
||||
* @return Damnit\Exception\Inspector
|
||||
* @return Whoops\Exception\Inspector
|
||||
*/
|
||||
protected function getInspector(Exception $exception)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ class Run
|
||||
|
||||
/**
|
||||
* Registers this instance as an error handler.
|
||||
* @return Damnit\Run
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
@@ -107,8 +107,8 @@ class Run
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters all handlers registered by this Damnit\Run instance
|
||||
* @return Damnit\Run
|
||||
* Unregisters all handlers registered by this Whoops\Run instance
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
@@ -123,7 +123,7 @@ class Run
|
||||
}
|
||||
|
||||
/**
|
||||
* Should Damnit allow Handlers to force the script to quit?
|
||||
* Should Whoops allow Handlers to force the script to quit?
|
||||
* @param bool|num $exit
|
||||
* @return bool|null
|
||||
*/
|
||||
@@ -137,7 +137,7 @@ class Run
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an exception, ultimately generating a Damnit error
|
||||
* Handles an exception, ultimately generating a Whoops error
|
||||
* page.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Exception;
|
||||
use Damnit\Exception\Frame;
|
||||
use Damnit\TestCase;
|
||||
namespace Whoops\Exception;
|
||||
use Whoops\Exception\Frame;
|
||||
use Whoops\TestCase;
|
||||
use Mockery as m;
|
||||
|
||||
class FrameTest extends TestCase
|
||||
@@ -26,7 +26,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Damnit\Exception\Frame
|
||||
* @return Whoops\Exception\Frame
|
||||
*/
|
||||
private function getFrameInstance($data = null)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getFile
|
||||
* @covers Whoops\Exception\Frame::getFile
|
||||
*/
|
||||
public function testGetFile()
|
||||
{
|
||||
@@ -49,7 +49,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getLine
|
||||
* @covers Whoops\Exception\Frame::getLine
|
||||
*/
|
||||
public function testGetLine()
|
||||
{
|
||||
@@ -60,7 +60,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getClass
|
||||
* @covers Whoops\Exception\Frame::getClass
|
||||
*/
|
||||
public function testGetClass()
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getFunction
|
||||
* @covers Whoops\Exception\Frame::getFunction
|
||||
*/
|
||||
public function testGetFunction()
|
||||
{
|
||||
@@ -82,7 +82,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getArgs
|
||||
* @covers Whoops\Exception\Frame::getArgs
|
||||
*/
|
||||
public function testGetArgs()
|
||||
{
|
||||
@@ -93,7 +93,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getFileContents
|
||||
* @covers Whoops\Exception\Frame::getFileContents
|
||||
*/
|
||||
public function testGetFileContents()
|
||||
{
|
||||
@@ -104,7 +104,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getFileLines
|
||||
* @covers Whoops\Exception\Frame::getFileLines
|
||||
*/
|
||||
public function testGetFileLines()
|
||||
{
|
||||
@@ -116,7 +116,7 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::getFileLines
|
||||
* @covers Whoops\Exception\Frame::getFileLines
|
||||
*/
|
||||
public function testGetFileLinesRange()
|
||||
{
|
||||
@@ -131,8 +131,8 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::addComment
|
||||
* @covers Damnit\Exception\Frame::getComments
|
||||
* @covers Whoops\Exception\Frame::addComment
|
||||
* @covers Whoops\Exception\Frame::getComments
|
||||
*/
|
||||
public function testGetComments()
|
||||
{
|
||||
@@ -157,8 +157,8 @@ class FrameTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Frame::addComment
|
||||
* @covers Damnit\Exception\Frame::getComments
|
||||
* @covers Whoops\Exception\Frame::addComment
|
||||
* @covers Whoops\Exception\Frame::getComments
|
||||
*/
|
||||
public function testGetFilteredComments()
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Exception;
|
||||
use Damnit\Exception\Inspector;
|
||||
use Damnit\TestCase;
|
||||
namespace Whoops\Exception;
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\TestCase;
|
||||
use RuntimeException;
|
||||
use Exception;
|
||||
|
||||
@@ -14,7 +14,7 @@ class InspectorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @param Exception $exception|null
|
||||
* @return Damnit\Exception\Inspector
|
||||
* @return Whoops\Exception\Inspector
|
||||
*/
|
||||
protected function getInspectorInstance(Exception $exception = null)
|
||||
{
|
||||
@@ -22,7 +22,7 @@ class InspectorTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Inspector::getExceptionName
|
||||
* @covers Whoops\Exception\Inspector::getExceptionName
|
||||
*/
|
||||
public function testReturnsCorrectExceptionName()
|
||||
{
|
||||
@@ -33,8 +33,8 @@ class InspectorTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Inspector::__construct
|
||||
* @covers Damnit\Exception\Inspector::getException
|
||||
* @covers Whoops\Exception\Inspector::__construct
|
||||
* @covers Whoops\Exception\Inspector::getException
|
||||
*/
|
||||
public function testExceptionIsStoredAndReturned()
|
||||
{
|
||||
@@ -45,13 +45,13 @@ class InspectorTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Inspector::getFrames
|
||||
* @covers Whoops\Exception\Inspector::getFrames
|
||||
*/
|
||||
public function testGetFramesReturnsIterator()
|
||||
{
|
||||
$exception = $this->getException();
|
||||
$inspector = $this->getInspectorInstance($exception);
|
||||
|
||||
$this->assertInstanceOf('Damnit\\Exception\\FrameIterator', $inspector->getFrames());
|
||||
$this->assertInstanceOf('Whoops\\Exception\\FrameIterator', $inspector->getFrames());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit\Handler;
|
||||
use Damnit\TestCase;
|
||||
use Damnit\Handler\JsonResponseHandler;
|
||||
namespace Whoops\Handler;
|
||||
use Whoops\TestCase;
|
||||
use Whoops\Handler\JsonResponseHandler;
|
||||
use RuntimeException;
|
||||
|
||||
class JsonResponseHandlerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return Damnit\Handler\JsonResponseHandler
|
||||
* @return Whoops\Handler\JsonResponseHandler
|
||||
*/
|
||||
private function getHandler()
|
||||
{
|
||||
@@ -52,8 +52,8 @@ class JsonResponseHandlerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Handler\JsonResponseHandler::addTraceToOutput
|
||||
* @covers Damnit\Handler\JsonResponseHandler::handle
|
||||
* @covers Whoops\Handler\JsonResponseHandler::addTraceToOutput
|
||||
* @covers Whoops\Handler\JsonResponseHandler::handle
|
||||
*/
|
||||
public function testReturnsWithoutFrames()
|
||||
{
|
||||
@@ -75,8 +75,8 @@ class JsonResponseHandlerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Handler\JsonResponseHandler::addTraceToOutput
|
||||
* @covers Damnit\Handler\JsonResponseHandler::handle
|
||||
* @covers Whoops\Handler\JsonResponseHandler::addTraceToOutput
|
||||
* @covers Whoops\Handler\JsonResponseHandler::handle
|
||||
*/
|
||||
public function testReturnsWithFrames()
|
||||
{
|
||||
|
||||
+17
-17
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit;
|
||||
use Damnit\TestCase;
|
||||
use Damnit\Run;
|
||||
use Damnit\Handler\Handler;
|
||||
namespace Whoops;
|
||||
use Whoops\TestCase;
|
||||
use Whoops\Run;
|
||||
use Whoops\Handler\Handler;
|
||||
use RuntimeException;
|
||||
use ArrayObject;
|
||||
use Mockery as m;
|
||||
@@ -15,11 +15,11 @@ use Mockery as m;
|
||||
class RunTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return Damnit\Handler\Handler
|
||||
* @return Whoops\Handler\Handler
|
||||
*/
|
||||
protected function getHandler()
|
||||
{
|
||||
return m::mock('Damnit\\Handler\\Handler')
|
||||
return m::mock('Whoops\\Handler\\Handler')
|
||||
->shouldReceive('setRun')
|
||||
->andReturn(null)
|
||||
->mock()
|
||||
@@ -35,7 +35,7 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::clearHandlers
|
||||
* @covers Whoops\Run::clearHandlers
|
||||
*/
|
||||
public function testClearHandlers()
|
||||
{
|
||||
@@ -48,7 +48,7 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::pushHandler
|
||||
* @covers Whoops\Run::pushHandler
|
||||
*/
|
||||
public function testPushHandler()
|
||||
{
|
||||
@@ -69,8 +69,8 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::popHandler
|
||||
* @covers Damnit\Run::getHandlers
|
||||
* @covers Whoops\Run::popHandler
|
||||
* @covers Whoops\Run::getHandlers
|
||||
*/
|
||||
public function testPopHandler()
|
||||
{
|
||||
@@ -98,7 +98,7 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::register
|
||||
* @covers Whoops\Run::register
|
||||
*/
|
||||
public function testRegisterHandler()
|
||||
{
|
||||
@@ -116,7 +116,7 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::unregister
|
||||
* @covers Whoops\Run::unregister
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testUnregisterHandler()
|
||||
@@ -132,8 +132,8 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::pushHandler
|
||||
* @covers Damnit\Run::getHandlers
|
||||
* @covers Whoops\Run::pushHandler
|
||||
* @covers Whoops\Run::getHandlers
|
||||
*/
|
||||
public function testHandlerHoldsOrder()
|
||||
{
|
||||
@@ -160,7 +160,7 @@ class RunTest extends TestCase
|
||||
/**
|
||||
* @todo possibly split this up a bit and move
|
||||
* some of this test to Handler unit tests?
|
||||
* @covers Damnit\Run::handleException
|
||||
* @covers Whoops\Run::handleException
|
||||
*/
|
||||
public function testHandlersGonnaHandle()
|
||||
{
|
||||
@@ -191,7 +191,7 @@ class RunTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::handleException
|
||||
* @covers Whoops\Run::handleException
|
||||
*/
|
||||
public function testLastHandler()
|
||||
{
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Damnit;
|
||||
use Damnit\Run;
|
||||
namespace Whoops;
|
||||
use Whoops\Run;
|
||||
use Mockery as m;
|
||||
|
||||
class TestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @return Damnit\Run
|
||||
* @return Whoops\Run
|
||||
*/
|
||||
protected function getRunInstance()
|
||||
{
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Damnit - php errors for cool kids
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*
|
||||
* Bootstraper for PHPUnit tests.
|
||||
*/
|
||||
$loader = require_once __DIR__ . '/../vendor/autoload.php';
|
||||
$loader->add('Damnit\\', __DIR__);
|
||||
$loader->add('Whoops\\', __DIR__);
|
||||
|
||||
Reference in New Issue
Block a user