avoid fatal error by throwing exception
Merge pull request #4401 from antograssiot/3.0

3.0 avoid fatal error by throwing exception