fix: show API error message when an error occurs during branch creation (#44638)

## Problem

When a user creates a branch but their GitHub account does not have
access to the repo, the UI shows a generic branch not found message.

## Solution

The API actually returns a more detailed message. Show it instead of the
generic one.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed error message handling when creating branches from invalid Git
references. Users will now receive appropriate error messages when
attempting to use a non-existent branch.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Gildas Garcia authored and GitHub committed 2026-04-07 20:13:09 +02:00
1 parent 8aeacc6152
commit 60992fd8d8
1 file changed
+3 -2
@@ -254,8 +254,9 @@ export const CreateBranchModal = () => {
if (form.getValues('gitBranchName') !== branchName) return
setIsGitBranchValid(false)
form.setError('gitBranchName', {
...error,
message: `Unable to find branch "${branchName}" in ${repoOwner}/${repoName}`,
message:
error?.message ??
`Unable to find branch "${branchName}" in ${repoOwner}/${repoName}`,
})
},
}