A new Exception type and handling invalid code