use distinct error messages; remove stray console.log