This looks clever...but why not just a try/catch in a forEach loop callback?