Common API JS error handling fix