Skip to content

Commit

Permalink
minor silexphp#1633 Add note about ExceptionHandler in CLI (hkdobrev)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.3.x-dev branch (closes silexphp#1633).

Discussion
----------

Add note about ExceptionHandler in CLI

Commits
-------

852b4fc Add note about ExceptionHandler in CLI
  • Loading branch information
fabpot committed Apr 2, 2018
2 parents da5d5f6 + 852b4fc commit dab3259
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/cookbook/error_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,15 @@ the ``$debug`` argument::
use Symfony\Component\Debug\ExceptionHandler;

ExceptionHandler::register(false);

.. note::

Important caveat when using Silex on a command-line interface:
The ``ExceptionHandler`` should not be enabled as it would convert an error
to HTML output and return a non-zero exit code::

use Symfony\Component\Debug\ExceptionHandler;

if (!in_array(PHP_SAPI, ['cli', 'phpdbg'])) {
ExceptionHandler::register();
}

0 comments on commit dab3259

Please sign in to comment.