How can I handle errors what I can from database #2284
-
So I'm developing a API using Go together with ORM package Entgo and Postgres. Is there a way to handle the errors same or similar way as they are solved in pg package where I have all needed information why query failed? All I found in ent go are this methods but they only return bool
It would be great to have something similar like pg.Error:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @petar-arandjic! ent wraps or returns the underlying driver errors. So, you can either use type-assertion or |
Beta Was this translation helpful? Give feedback.
Hey @petar-arandjic! ent wraps or returns the underlying driver errors. So, you can either use type-assertion or
errors.Is
/errors.As
helpers to extract these types. See examples in our integration-test: 1, 2.