How to write a good exception code class.