improve fix for issue 10405 - move non-void error check in front of semantic calls