Problem/Motivation

In case of the Cart route/page (/admin/tmgmt/cart) if the XTM server is not responding (due to its problems or no internet connection)
the page is breaking with the following error:

The website encountered an unexpected error. Please try again later.

Drupal\tmgmt\TMGMTException: Could not connect to the XTM SOAP service. Please check settings. URL:https://api-test.xtm-intl.com/project-manager-gui/services/v2/projectmanager/XTMWebService?wsdl in Drupal\tmgmt_xtm\Plugin\tmgmt\Translator\Connector->checkRequestConditions() (line 397 of modules/custom/tmgmt_xtm/src/Plugin/tmgmt/Translator/Connector.php).

This is due because the Connector::doRequest method will throw a TMGMTException unhandled exception (in the Connector->getTemplates(Object) method), generated by this: $this->checkRequestConditions($translator, $action);

Steps to reproduce

Locally disable your internet connection and visit the Cart route/page (/admin/tmgmt/cart).

Proposed resolution

Add the missing catch of TMGMTException in the Connector->getTemplates(Object) method ...

Comments

itamair created an issue. See original summary.

itamair’s picture

Status: Active » Needs review
StatusFileSize
new590 bytes

The attached patch applies the proposes resolution.

itamair’s picture

Worth to mention that the whole Connector.php class looks filled with catch instances related to its doRequest method that could probably all refactored and packed into the doRequest method itself ...

  • itamair authored 1e4fc23 on 8.x-5.x
    Issue #3222566 by itamair: Cart TMGMTException unhandled error in case...
pjassem’s picture

Status: Needs review » Fixed

Thanks a million, Italo!
Your changes are on the development branch and will be released in the near future.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.