Modified error handling to use exceptions. Added new tests cases for
type checker.