define some exceptions for the bits and pieces to throw and convert current code to use this.
(mostly for the unit testing)