add custom error handler to js