Add JS error logging to AMD