"ent: constraint failed: FOREIGN KEY constraint failed" get more verbose error output

34 Views Asked by At

Logging error coming after failed insert to db using ent shows:

ent: constraint failed: FOREIGN KEY constraint failed.

Is there a way to get more verbose formatting of the error, e.g. FOREIGN KEY that wasn't set?

I'm using below code for logging the error:

import (
   "github.com/labstack/gommon/log"
)

...
err := // some failed insert to db
if err != nil {
   log.Errorf("Error is %v", err)
}
...

err doesn't seem to provide any relevant methods.

0

There are 0 best solutions below