CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.4 Strawberry API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 4.4
      • 6.0
      • 5.4
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Namespace Error

Namespaces

  • Cake\Error\Debug
  • Cake\Error\Middleware
  • Cake\Error\Renderer

Interfaces

  • ErrorLoggerInterface

    Interface for error logging handlers.

    Used by the ErrorHandlerMiddleware and global error handlers to log exceptions and errors.

  • ErrorRendererInterface

    Interface for PHP error rendering implementations

    The core provided implementations of this interface are used by Debugger and ErrorTrap to render PHP errors.

  • ExceptionRendererInterface

    Interface ExceptionRendererInterface

Classes

  • BaseErrorHandler

    Base error handler that provides logic common to the CLI + web error/exception handlers.

    Subclasses are required to implement the template methods to handle displaying the errors in their environment.

  • ConsoleErrorHandler

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

  • Debugger

    Provide custom logging and error handling.

    Debugger extends PHP's default error handling and gives simpler to use more powerful interfaces.

  • ErrorHandler

    Error Handler provides basic error and exception handling for your application. It captures and handles all unhandled exceptions and errors. Displays helpful framework errors when debug mode is on.

    Uncaught exceptions

    When debug mode is off a ExceptionRenderer will render 404 or 500 errors. If an uncaught exception is thrown and it is a type that ExceptionRenderer does not know about it will be treated as a 500 error.

    Implementing application specific exception handling

    You can implement application specific exception handling in one of a few ways. Each approach gives you different amounts of control over the exception handling process.

    • Modify config/error.php and setup custom exception handling.
    • Use the exceptionRenderer option to inject an Exception renderer. This will let you keep the existing handling logic but override the rendering logic.

    Create your own Exception handler

    This gives you full control over the exception handling process. The class you choose should be loaded in your config/error.php and registered as the default exception handler.

    Using a custom renderer with exceptionRenderer

    If you don't want to take control of the exception handling, but want to change how exceptions are rendered you can use exceptionRenderer option to choose a class to render exception pages. By default Cake\Error\ExceptionRenderer is used. Your custom exception renderer class should be placed in src/Error.

    Your custom renderer should expect an exception in its constructor, and implement a render method. Failing to do so will cause additional errors.

    Logging exceptions

    Using the built-in exception handling, you can log all the exceptions that are dealt with by ErrorHandler by setting log option to true in your config/error.php. Enabling this will log every exception to Log and the configured loggers.

    PHP errors

    Error handler also provides the built in features for handling php errors (trigger_error). While in debug mode, errors will be output to the screen using debugger. While in production mode, errors will be logged to Log. You can control which errors are logged by setting errorLevel option in config/error.php.

    Logging errors

    When ErrorHandler is used for handling errors, you can enable error logging by setting the log option to true. This will log all errors to the configured log handlers.

    Controlling what errors are logged/displayed

    You can control which errors are logged / displayed by ErrorHandler by setting errorLevel. Setting this to one or a combination of a few of the E_* constants will only enable the specified errors:

    $options['errorLevel'] = E_ALL & ~E_NOTICE;

    Would enable handling for all non Notice errors.

  • ErrorLogger

    Log errors and unhandled exceptions to Cake\Log\Log

  • ErrorTrap

    Entry point to CakePHP's error handling.

    Using the register() method you can attach an ErrorTrap to PHP's default error handler.

    When errors are trapped, errors are logged (if logging is enabled). Then the Error.beforeRender event is triggered. Finally, errors are 'rendered' using the defined renderer. If no error renderer is defined in configuration one of the default implementations will be chosen based on the PHP SAPI.

  • ExceptionRenderer

    Backwards compatible Exception Renderer.

  • ExceptionTrap

    Entry point to CakePHP's exception handling.

    Using the register() method you can attach an ExceptionTrap to PHP's default exception handler and register a shutdown handler to handle fatal errors.

    When exceptions are trapped the Exception.beforeRender event is triggered. Then exceptions are logged (if enabled) and finally 'rendered' using the defined renderer.

    Stopping the Exception.beforeRender event has no effect, as we always need to render a response to an exception and custom renderers should be used if you want to replace or skip rendering an exception.

    If undefined, an ExceptionRenderer will be selected based on the current SAPI (CLI or Web).

  • FatalErrorException

    Represents a fatal error

  • PhpError

    Object wrapper around PHP errors that are emitted by trigger_error()

OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs