mirror of https://github.com/go-gorm/gorm.git
refactor: improve logging for unimplemented ErrorTranslator in TranslateError config (#7225)
This commit is contained in:
parent
62bd0b9331
commit
8020e8c166
6
gorm.go
6
gorm.go
|
@ -189,6 +189,12 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) {
|
|||
_ = db.Close()
|
||||
}
|
||||
}
|
||||
|
||||
if config.TranslateError {
|
||||
if _, ok := db.Dialector.(ErrorTranslator); !ok {
|
||||
config.Logger.Warn(context.Background(), "The TranslateError option is enabled, but the Dialector %s does not implement ErrorTranslator.", db.Dialector.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.PrepareStmt {
|
||||
|
|
Loading…
Reference in New Issue