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
Comment #2
itamair commentedThe attached patch applies the proposes resolution.
Comment #3
itamair commentedWorth to mention that the whole Connector.php class looks filled with
catchinstances related to its doRequest method that could probably all refactored and packed into the doRequest method itself ...Comment #5
pjassem commentedThanks a million, Italo!
Your changes are on the development branch and will be released in the near future.