Skip to content

Commit 75beab0

Browse files
cantuariavceribeiro
authored andcommitted
HOT-FIX: Adiciona try/catch no Solr
1 parent 38e3146 commit 75beab0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docker/solr_api.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ def __init__(self, url):
2727
def get_num_docs(self, collection_name):
2828
final_url = self.QUERY_DATA.format(self.url, collection_name)
2929
res = requests.get(final_url)
30-
dic = res.json()
31-
num_docs = dic["response"]["numFound"]
32-
return num_docs
30+
try:
31+
dic = res.json()
32+
num_docs = dic["response"]["numFound"]
33+
return num_docs
34+
except Exception as e:
35+
print(F"Erro no get_num_docs: {e}")
36+
print(res.content)
37+
return 0
3338

3439
def list_collections(self):
3540
req_url = self.LIST_COLLECTIONS.format(self.url)

0 commit comments

Comments
 (0)