fix(pr/shared): improve ParseFullReference error message

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2026-01-21 23:30:43 +00:00
parent bd0177b039
commit 0d8a697c7c
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
2 changed files with 6 additions and 1 deletions

View file

@ -349,7 +349,7 @@ func ParseFullReference(s string) (ghrepo.Interface, int, error) {
number, err := strconv.Atoi(m[3])
if err != nil {
return nil, 0, fmt.Errorf("invalid reference: %q", s)
return nil, 0, fmt.Errorf("invalid reference: %q; %w", s, err)
}
owner := m[1]

View file

@ -160,6 +160,11 @@ func TestParseFullReference(t *testing.T) {
arg: "OWNER/#123",
wantErr: `invalid reference: "OWNER/#123"`,
},
{
name: "invalid full form, too large number",
arg: "OWNER/REPO#9999999999999999999",
wantErr: `invalid reference: "OWNER/REPO#9999999999999999999"; strconv.Atoi: parsing "9999999999999999999": value out of range`,
},
}
for _, tt := range tests {