[Pg] reafctoring handling status code