refector some exception code