Add js unit tests for error handling bug.