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

[11.15] Repository branch and file check existence methods #782

Open
wants to merge 2 commits into
base: 11.15
Choose a base branch
from

Conversation

misantron
Copy link

No description provided.

@misantron
Copy link
Author

Hello, take a look please

Copy link
Member

@GrahamCampbell GrahamCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes don't seem work properly. Instead of returning false if not exists, this actually throw an exception. We are, critically, missing tests for that case.

@GrahamCampbell GrahamCampbell changed the title [11.13] Repository branch and file check existence methods [11.14] Repository branch and file check existence methods Dec 3, 2023
@GrahamCampbell GrahamCampbell changed the base branch from 11.13 to 11.14 December 3, 2023 22:46
@misantron
Copy link
Author

try {
   $this->head($uri, []);
            
   return true;
} catch (Gitlab\Exception\RuntimeException $ex) {
   if (404 === $ex->getCode()) {
      return false;
   }
   throw $ex;
}

@GrahamCampbell can I use such a code to handle exception and check entity existence?

@GrahamCampbell GrahamCampbell changed the title [11.14] Repository branch and file check existence methods [11.15] Repository branch and file check existence methods Mar 17, 2024
@GrahamCampbell GrahamCampbell changed the base branch from 11.14 to 11.15 March 17, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants