Problem/Motivation

When the CKEditor Cloud Service is unreachable (e.g. connection timeout, DNS failure), Guzzle throws a ConnectException. The sendRequest() method in ApiAdapter catches GuzzleException (the common interface) and calls $e->getResponse() on it. However, ConnectException does not implement getResponse() — only RequestException does. This causes a fatal PHP Error that crashes the node edit form validation for logged-in editors.

Stack trace:

Error: Call to undefined method GuzzleHttp\Exception\ConnectException::getResponse()
in ckeditor5_premium_features/src/Utility/ApiAdapter.php

Steps to reproduce

Install and configure ckeditor5_premium_features with realtime collaboration.
Make the CKEditor Cloud Service unreachable (e.g. block the API endpoint or use an invalid API URL).
Open a node edit form that uses the configured text format.
Submit the form — a fatal PHP Error is thrown during form validation.

Proposed resolution

Split the single catch (GuzzleException $e) block into three separate catch blocks:

  • ConnectException — handle without calling getResponse() (the method does not exist on this class)
  • RequestException — safe to call getResponse() here
  • GuzzleException — generic fallback for any other Guzzle error

A patch is attached.

Remaining tasks

Review and apply the patch
Add test coverage for ConnectException handling

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lohndaniel created an issue. See original summary.

lohndaniel’s picture

Status: Active » Needs review
mdusza’s picture

Hi lohndaniel, thanks for reporting the issue - we'll look into this.

salmonek made their first commit to this issue’s fork.

salmonek’s picture

Status: Needs review » Reviewed & tested by the community

Thank you lohndaniel for the report and fix.
We have additional ApiAdapter for AI module, I applied the fix for both adapters.

salmonek’s picture

Status: Reviewed & tested by the community » Fixed

Released in 1.8.3

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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