'How do I get the same detailed error in asyncpg as in psycopg?

Is there any way I can get a detailed description of the error in asyncpg such as in psycopg?

Desired:

ERROR:  syntax error at or near "entries_based_on_types"
LINE 39:  WHERE entry_id IN entries_based_on_t...
                            ^

Retrieved:

asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "entries_based_on_types"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source