how to parse mysql error golang
I found some hints in packets.go and driver_test.go
Example:
me, ok := err.(*mysql.MySQLError)
if !ok {
return err
}
if me.Number == 1062 {
return errors.New("It already exists in a database.")
}
return err
Possible values of me.Number
can be found in mysql documentation