পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, February 16, 2017

Drupal - Error Handling

In this chapter, we will study about Drupal error handling for managing error messages on Drupal site.
Error Handling is a process of detection and finding the resolutions for the errors, this can be programming application errors or communicable errors.

The below steps describe managing error messages in Drupal:
Step (1): Go to Configuration and click on Logging and errors.
Drupal Error Handling Step (2): Next, Logging and errors page will get displayed as shown below.
Drupal Error Handling The fields as seen the above screen are discussed below:
  • Error messages to display: It specifies error messages to be displayed on the Drupal site.
    • None option doesn't display any error message.
    • Errors and warnings option displays only messages related to errors and warnings.
    • All messages option specifies all the error messages such as errors, warnings etc to be displayed on the site.
  • Database log messages to keep: It indicates the maximum number of messages to kept in the database log.
Drupal uses _drupal_exception_handler ($exception) function to handle the errors in the site. These errors will not be enclosed in a try/catch block. The script won't execute the function when an exception handler exits.
The code for _drupal_exception_handler will be shown as below:
function _drupal_exception_handler($exception) {
  require_once DRUPAL_ROOT . '/includes/errors.inc';

  try {
    // display the error message in the log and return the error messages to the user
    _drupal_log_error(_drupal_decode_exception($exception), TRUE);
  }
  catch (Exception $excp2) {
    // Another uncaught exception was thrown while handling the first one.
    // If we are displaying errors, then do so with no possibility of a further uncaught exception being thrown.
    if (error_displayable()) {
      print '<h1>Additional uncaught exception thrown while handling exception.</h1>';
      print '<h2>Original</h2><p>' . _drupal_render_exception_safe($exception) . '</p>';
      print '<h2>Additional</h2><p>' . _drupal_render_exception_safe($excp2) . '</p><hr />';
    }
  }
}
The function must be used on every Drupal request. This function is present at the line 2328 in the file includes/bootstrap.inc .
There are two string references to _drupal_exception_handler such as _drupal_bootstrap_configuration() present in the bootstrap.inc file and _drupal_get_last_caller present in the errors.inc file. Both these files are present in the includes folder.


No comments:

Post a Comment