Fix up my refactoring mistake in toThrowError

strengthen the associated tests to protect against it in the future
Merge pull request #379 from sheelc/toThrowError_fixup

Fix up refactoring mistake in toThrowError