Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI-1292: Catch Cloud API type errors #1701

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
}
}

if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\Response')) {

Check warning on line 82 in src/EventListener/ExceptionListener.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ $this->helpMessages[] = "You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/"; } } - if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { + if (false && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { $newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.'; } $this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";

Check warning on line 82 in src/EventListener/ExceptionListener.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ $this->helpMessages[] = "You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/"; } } - if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { + if (true && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { $newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.'; } $this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";

Check warning on line 82 in src/EventListener/ExceptionListener.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $this->helpMessages[] = "You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/"; } } - if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { + if ($error instanceof \TypeError || str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { $newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.'; } $this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";

Check warning on line 82 in src/EventListener/ExceptionListener.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "LogicalAndAllSubExprNegation": --- Original +++ New @@ @@ $this->helpMessages[] = "You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/"; } } - if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { + if (!$error instanceof \TypeError && !str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { $newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.'; } $this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";

Check warning on line 82 in src/EventListener/ExceptionListener.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ $this->helpMessages[] = "You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/"; } } - if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { + if ($error instanceof \TypeError && !str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { $newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.'; } $this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";

Check warning on line 82 in src/EventListener/ExceptionListener.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "LogicalAndNegation": --- Original +++ New @@ @@ $this->helpMessages[] = "You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/"; } } - if ($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response')) { + if (!($error instanceof \TypeError && str_contains($error->getMessage(), 'AcquiaCloudApi\\Response'))) { $newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.'; } $this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";
danepowell marked this conversation as resolved.
Show resolved Hide resolved
$newErrorMessage = 'Cloud API returned an unexpected data type; this could indicate a problem with your Cloud application.';

Check warning on line 83 in src/EventListener/ExceptionListener.php

View check run for this annotation

Codecov / codecov/patch

src/EventListener/ExceptionListener.php#L83

Added line #L83 was not covered by tests
danepowell marked this conversation as resolved.
Show resolved Hide resolved
}

$this->helpMessages[] = "You can find Acquia CLI documentation at https://docs.acquia.com/acquia-cli/";
$this->writeUpdateHelp($event);
$this->writeSupportTicketHelp($event);
Expand Down