Put macro replacement code in try block to handle exceptions