catch pg exception