Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adiciona um tratamento de erro no momento de cadastrar os suplementos do artigo. #325

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion airflow/dags/operations/sync_kernel_to_website_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Callable, Iterable, Generator, Dict, List, Tuple

import requests
import mongoengine
from lxml import etree as et
from opac_schema.v1 import models

Expand Down Expand Up @@ -637,7 +638,15 @@ def _get_doi_with_lang(article, sps_package):
# Cadastra o material suplementar
if fetch_documents_manifest:
json = fetch_documents_manifest(document_id)
article.mat_suppl = _get_suppl_material(document_id, json)
mat_suppl = _get_suppl_material(document_id, json)

try:
article.mat_suppl = mat_suppl
article.save()
except mongoengine.errors.ValidationError as ex:
logging.error("Erro ao tentar salvar o material supplementar do artigo!, error: %s", ex)
logging.error("Contéudo retornado na função que obtém a lista de suplemento: %s", mat_suppl)
article.mat_suppl = []

xml = fetch_document_xml(document_id)

Expand Down