fix: sentry bug

This commit is contained in:
Andras Bacsai 2023-09-01 11:35:33 +02:00
parent 71e1571c39
commit 66162966b9
2 changed files with 15 additions and 13 deletions

View File

@ -39,7 +39,7 @@ class PublicGitRepository extends Component
'publish_directory' => 'publish directory',
];
private object $repository_url_parsed;
private GithubApp|GitlabApp $git_source;
private GithubApp|GitlabApp|null $git_source = null;
private string $git_host;
private string $git_repository;
@ -67,18 +67,17 @@ public function instantSave()
public function load_branch()
{
try {
$this->branch_found = false;
$this->validate([
'repository_url' => 'required|url'
]);
$this->get_git_source();
try {
$this->get_branch();
$this->selected_branch = $this->git_branch;
} catch (\Exception $e) {
return general_error_handler(err: $e, that: $this);
}
if (!$this->branch_found && $this->git_branch == 'main') {
try {
$this->git_branch = 'master';
@ -103,6 +102,9 @@ private function get_git_source()
} elseif ($this->git_host == 'bitbucket.org') {
// Not supported yet
}
if (is_null($this->git_source)) {
throw new \Exception('Git source not found. What?!');
}
}
private function get_branch()