Skip to content

Commit fe26720

Browse files
nmiyakegmlewis
authored andcommitted
Make error return style in repos_hooks.go consistent (#951)
1 parent e96f1f1 commit fe26720

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: github/repos_hooks.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i
136136
if err != nil {
137137
return nil, nil, err
138138
}
139-
hook := new(Hook)
140-
resp, err := s.client.Do(ctx, req, hook)
141-
return hook, resp, err
139+
h := new(Hook)
140+
resp, err := s.client.Do(ctx, req, h)
141+
if err != nil {
142+
return nil, resp, err
143+
}
144+
145+
return h, resp, nil
142146
}
143147

144148
// EditHook updates a specified Hook.
@@ -152,7 +156,11 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string,
152156
}
153157
h := new(Hook)
154158
resp, err := s.client.Do(ctx, req, h)
155-
return h, resp, err
159+
if err != nil {
160+
return nil, resp, err
161+
}
162+
163+
return h, resp, nil
156164
}
157165

158166
// DeleteHook deletes a specified Hook.

0 commit comments

Comments
 (0)