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 3.8 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.8
      • 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\Middleware

Interfaces

  • 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.

  • Debugger

    Provide custom logging and error handling.

    Debugger overrides PHP's default error handling to provide stack traces and enhanced logging

  • 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.

  • ExceptionRenderer

    Exception Renderer.

    Captures and handles all unhandled exceptions. Displays helpful framework errors when debug is true. When debug is false a ExceptionRenderer will render 404 or 500 errors. If an uncaught exception is thrown and it is a type that ExceptionHandler does not know about it will be treated as a 500 error.

    Implementing application specific exception rendering

    You can implement application specific exception handling by creating a subclass of ExceptionRenderer and configure it to be the exceptionRenderer in config/error.php

    Using a subclass of ExceptionRenderer

    Using a subclass of ExceptionRenderer gives you full control over how Exceptions are rendered, you can configure your class in your config/app.php.

  • FatalErrorException

    Represents a fatal error

  • PHP7ErrorException

    Wraps a PHP 7 Error object inside a normal Exception so it can be handled correctly by the rest of the error handling system

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