edit to use object based exception
small change to move msg into if branch