Skip to content

Commit 2a0b7cf

Browse files
committed
fix: error name should end with error in Go
1 parent a358f58 commit 2a0b7cf

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

dbctl/internal/transform/transform.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ func ExtractPRID(title string) (int32, error) {
181181
return int32(atoi), nil
182182
}
183183

184-
type ErrNotYouTubeLink struct {
184+
type InvalidYouTubeLinkError struct {
185185
url string
186186
}
187187

188-
func (e ErrNotYouTubeLink) Error() string {
189-
return fmt.Sprintf("no valid YouTubeID is found in %s", e.url)
188+
func (e InvalidYouTubeLinkError) Error() string {
189+
return fmt.Sprintf("invalid YouTubeID is found in %s", e.url)
190190
}
191191

192192
// ExtractYouTubeID extracts videoID from YouTube link
@@ -202,7 +202,7 @@ func ExtractYouTubeID(link string) (string, error) {
202202
return "", err
203203
}
204204

205-
errNotYouTubeLink := ErrNotYouTubeLink{link}
205+
errNotYouTubeLink := InvalidYouTubeLinkError{link}
206206

207207
if strings.Contains(parse.Hostname(), "youtube") {
208208
youtubeID := parse.Query().Get("v")

server/internal/err/err.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package err
22

33
import "fmt"
44

5-
// ErrorPrIDNotFound is used when PR ID is not found in Database.
6-
type ErrorPrIDNotFound struct {
5+
// PrIDNotFoundError is used when PR ID is not found in Database.
6+
type PrIDNotFoundError struct {
77
PrID int32
88
}
99

1010
// Error implements Error interface.
11-
func (e ErrorPrIDNotFound) Error() string {
11+
func (e PrIDNotFoundError) Error() string {
1212
return fmt.Sprintf("PR-%d was not found", e.PrID)
1313
}

server/pkg/handlers/handlers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (h *Handler) VideosResponseFromDB(db *pr12er.Database) *pr12er.GetVideosRes
5454
func (h *Handler) DetailResponseFromDB(prID int32, db *pr12er.Database) (*pr12er.GetDetailResponse, error) {
5555
video, ok := db.GetPrIdToVideo()[prID]
5656
if !ok {
57-
return nil, err.ErrorPrIDNotFound{PrID: prID}
57+
return nil, err.PrIDNotFoundError{PrID: prID}
5858
}
5959

6060
return &pr12er.GetDetailResponse{

server/pkg/pr12er/database.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/pkg/pr12er/messages.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/pkg/pr12er/service.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)