added ability to log errors via JS, fixes #68