gateway try catch