Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-930

Do not throw exceptions for critical and error levels in libmongoc log callback

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.0-beta1, 1.3.0
    • Affects Version/s: 1.2.6
    • Component/s: None
    • None

      Currently, php_phongo_log() throws exceptions for "error" and "critical' log levels and logs to the configured debug stream (e.g. stderr, output file) for all other levels. This is inconsistent for a few reasons:

      • mongodb.debug is only documented as adding background log functionality, while exceptions may disrupt application flow.
      • These exceptions are subject to change by internal changes in libmongoc and do not depend on the PHP extension. As such, new exceptions might show up after upgrading libmongoc if the driver is configured to use shared libraries.
      • We generally check for libmongoc errors already and throw our own exceptions. In these cases, an exception resulting from a libmongoc error may end up as a previous exception when we throw our own.
      • php_phongo_log() calls phongo_throw_exception(), which calls phongo_exception_from_phongo_domain(), which calls MONGOC_ERROR() if the domain is unknown. This is a possible cycle, although it is never triggered since phongo_throw_exception() always specifies a valid domain. Nevertheless, it would be nice to clean this up.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: