smarter error reporting