We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6d86407 commit e40cbd1Copy full SHA for e40cbd1
1 file changed
adapter.go
@@ -90,7 +90,7 @@ func (a *Adapter) createDatabase() error {
90
if a.driverName == "postgres" {
91
if _, err = engine.Exec("CREATE DATABASE casbin"); err != nil {
92
// 42P04 is duplicate_database
93
- if err.(*pq.Error).Code == "42P04" {
+ if pqerr, ok := err.(*pq.Error); ok && pqerr.Code == "42P04" {
94
return nil
95
}
96
0 commit comments