コード例 #1
0
 public function testItReturnsUsefulErrorIfUnknownAndInDevelopment()
 {
     putenv('APP_ENV=development');
     $exception = new RuntimeException('Some message.');
     $handled = ExceptionHandler::handleException($exception);
     $this->assertEquals(['error' => $exception->getCode(), 'message' => $exception->getMessage(), 'trace' => $exception->getTraceAsString()], $handled);
 }
コード例 #2
0
<?php

/**
 * Setup dependencies and environment
 */
require __DIR__ . '/vendor/autoload.php';
use Fuzz\ImageResizer\App;
use Fuzz\ImageResizer\ExceptionHandler;
use Symfony\Component\HttpFoundation\Request;
try {
    echo App::run(Request::createFromGlobals());
} catch (Exception $e) {
    echo json_encode(ExceptionHandler::handleException($e));
}