adding error handler on JS

Signed-off-by: Siddhartha Gupta <makerzzz.zzzz@gmail.com>