Class ConsoleErrorHandler

Error Handler for Cake console. Does simple printing of the exception that occurred and the stack trace of the error.

Package: Cake\Console
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/ConsoleErrorHandler.php

Properties summary

Method Summary

  • _stop() protected
    Wrapper for exit(), used for testing.
  • getStderr() public static
    Get the stderr object for the console error handling.
  • handleError() public

    Handle errors in the console environment. Writes errors to stderr, and logs messages if Configure::read('debug') is 0.

  • Handle an exception in the console environment. Prints a message to stderr.

Method Detail

_stop()source protected

_stop( integer $code 0 )

Wrapper for exit(), used for testing.

Parameters

integer $code optional 0
The exit code.

getStderr()source public static

getStderr( )

Get the stderr object for the console error handling.

Returns

ConsoleOutput

handleError()source public

handleError( integer $code , string $description , string $file null , integer $line null , array $context null )

Handle errors in the console environment. Writes errors to stderr, and logs messages if Configure::read('debug') is 0.

Parameters

integer $code
Error code
string $description
Description of the error.
string $file optional null
The file the error occurred in.
integer $line optional null
The line the error occurred on.
array $context optional null
The backtrace of the error.

handleException()source public

handleException( Exception|ParserError $exception )

Handle an exception in the console environment. Prints a message to stderr.

Parameters

Exception|ParserError $exception
The exception to handle

Properties detail

$stderrsource

public static ConsoleOutput

Standard error stream.

© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-ConsoleErrorHandler.html