Skip to content

Commit

Permalink
Merge pull request #33 from lefinal/feat-enhance-scan-db-err
Browse files Browse the repository at this point in the history
feat(mehpg): reuse logic from NewQueryDBErr in NewScanRowsErr
  • Loading branch information
lefinal authored Mar 18, 2024
2 parents f5bb764 + c50aca5 commit 1374bbb
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions mehpg/mehpg.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,10 @@ func NewQueryDBErr(err error, message string, query string, args ...any) error {
}

// NewScanRowsErr creates a new meh.ErrInternal with the given error and message
// and saves the provided query to details.
// and saves the provided query to details. The used logic is currently the same
// as NewQueryDBErr but placed in a separate method for future adjustments.
func NewScanRowsErr(err error, message string, query string, args ...any) error {
return &meh.Error{
Code: meh.ErrInternal,
WrappedErr: err,
Message: message,
Details: meh.Details{
"query": query,
"args": args,
},
}
return NewQueryDBErr(err, message, query, args...)
}

// NewQueryAndScanRowsErr is used for errors returned from QueryRow with Scan.
Expand Down

0 comments on commit 1374bbb

Please sign in to comment.