Skip to content

Commit

Permalink
fix: error name should end with error in Go
Browse files Browse the repository at this point in the history
  • Loading branch information
kkweon committed Aug 18, 2021
1 parent a358f58 commit 2a0b7cf
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions dbctl/internal/transform/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ func ExtractPRID(title string) (int32, error) {
return int32(atoi), nil
}

type ErrNotYouTubeLink struct {
type InvalidYouTubeLinkError struct {
url string
}

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

// ExtractYouTubeID extracts videoID from YouTube link
Expand All @@ -202,7 +202,7 @@ func ExtractYouTubeID(link string) (string, error) {
return "", err
}

errNotYouTubeLink := ErrNotYouTubeLink{link}
errNotYouTubeLink := InvalidYouTubeLinkError{link}

if strings.Contains(parse.Hostname(), "youtube") {
youtubeID := parse.Query().Get("v")
Expand Down
6 changes: 3 additions & 3 deletions server/internal/err/err.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package err

import "fmt"

// ErrorPrIDNotFound is used when PR ID is not found in Database.
type ErrorPrIDNotFound struct {
// PrIDNotFoundError is used when PR ID is not found in Database.
type PrIDNotFoundError struct {
PrID int32
}

// Error implements Error interface.
func (e ErrorPrIDNotFound) Error() string {
func (e PrIDNotFoundError) Error() string {
return fmt.Sprintf("PR-%d was not found", e.PrID)
}
2 changes: 1 addition & 1 deletion server/pkg/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (h *Handler) VideosResponseFromDB(db *pr12er.Database) *pr12er.GetVideosRes
func (h *Handler) DetailResponseFromDB(prID int32, db *pr12er.Database) (*pr12er.GetDetailResponse, error) {
video, ok := db.GetPrIdToVideo()[prID]
if !ok {
return nil, err.ErrorPrIDNotFound{PrID: prID}
return nil, err.PrIDNotFoundError{PrID: prID}
}

return &pr12er.GetDetailResponse{
Expand Down
2 changes: 1 addition & 1 deletion server/pkg/pr12er/database.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/pkg/pr12er/messages.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/pkg/pr12er/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2a0b7cf

Please sign in to comment.