Chore: Enable errorlint linter (#29227)
* Enable errorlint linter * Handle wrapped errors Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
co-authored by
Emil Tullstedt
parent
993adb72e0
commit
9593d57914
@@ -1,6 +1,7 @@
|
||||
package migrator
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -169,7 +170,8 @@ func (db *MySQLDialect) TruncateDBTables() error {
|
||||
}
|
||||
|
||||
func (db *MySQLDialect) isThisError(err error, errcode uint16) bool {
|
||||
if driverErr, ok := err.(*mysql.MySQLError); ok {
|
||||
var driverErr *mysql.MySQLError
|
||||
if errors.As(err, &driverErr) {
|
||||
if driverErr.Number == errcode {
|
||||
return true
|
||||
}
|
||||
@@ -183,7 +185,8 @@ func (db *MySQLDialect) IsUniqueConstraintViolation(err error) bool {
|
||||
}
|
||||
|
||||
func (db *MySQLDialect) ErrorMessage(err error) string {
|
||||
if driverErr, ok := err.(*mysql.MySQLError); ok {
|
||||
var driverErr *mysql.MySQLError
|
||||
if errors.As(err, &driverErr) {
|
||||
return driverErr.Message
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user