refactore js error handlers