Fixes #721, if global onError set, then use that for require errors