Improve document not found error handling
This commit is contained in:
parent
21413b183a
commit
88a9d98c0a
|
|
@ -88,6 +88,7 @@ def augment_fields(raw_data):
|
|||
data['value'] = augment_fields(item_data)
|
||||
|
||||
if _type == 'cms_document_block':
|
||||
try:
|
||||
_value = data['value']
|
||||
document = CustomDocument.objects.get(id=_value)
|
||||
value = {
|
||||
|
|
@ -100,6 +101,8 @@ def augment_fields(raw_data):
|
|||
'display_text': document.display_text
|
||||
}
|
||||
data['value'] = value
|
||||
except CustomDocument.DoesNotExist:
|
||||
logger.error('CustomDocument {} does not exist'.format(_value))
|
||||
|
||||
return raw_data
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue