volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

Inspecting errors #353

Closed diraven closed 6 years ago

diraven commented 6 years ago

According to https://github.com/volatiletech/sqlboiler/blob/master/boil/errors.go error is hidden behind unexported boilErr struct type. How does one extract the underlying error for inspection, such as to see more details (code etc.) via .(*pg.Error) postgres (or any other for that matter) driver provides?

PS: it's the same for v3 branch.

Thank you.

aarondl commented 6 years ago

WrapErr is only used when panic occurs. Normal errors use the github.com/pkg/errors package which has a Cause method you can use to extract the underlying error.

diraven commented 6 years ago

Thank you.