So it's a two step process for me currently because of this, I would love if there was a better way to handle
this type of work though, because my plpgsql functions using exception blocks are not exactly great
for performance.
Probably we can for some important buildin types write method "is_valid", and this method can be called directly. For custom types or for types without this method, the solution based on exceptions can be used.
This should not be too much code, and can be fast for often used types.