Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1416 Properly logging exception
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Jan 25, 2023
1 parent 2b61735 commit 05e47cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/code_systems/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ def to_representation(self, instance):
try:
rep = super().to_representation(instance)
IdentifierSerializer.include_ocl_identifier(instance.uri, RESOURCE_TYPE, rep)
except Exception as error:
except (Exception, ):
msg = f'Failed to represent "{instance.uri}" as {RESOURCE_TYPE}'
logger.error(msg, error)
logger.exception(msg)
return {
'resourceType': 'OperationOutcome',
'issue': [{
Expand Down
4 changes: 2 additions & 2 deletions core/concept_maps/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def to_representation(self, instance):
try:
rep = super().to_representation(instance)
IdentifierSerializer.include_ocl_identifier(instance.uri, RESOURCE_TYPE, rep)
except Exception as error:
except (Exception, ):
msg = f'Failed to represent "{instance.uri}" as {RESOURCE_TYPE}'
logger.error(msg, error)
logger.exception(msg)
return {
'resourceType': 'OperationOutcome',
'issue': [{
Expand Down
4 changes: 2 additions & 2 deletions core/value_sets/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def to_representation(self, instance):
try:
rep = super().to_representation(instance)
IdentifierSerializer.include_ocl_identifier(instance.uri, RESOURCE_TYPE, rep)
except Exception as error:
except (Exception, ):
msg = f'Failed to represent "{instance.uri}" as {RESOURCE_TYPE}'
logger.error(msg, error)
logger.exception(msg)
return {
'resourceType': 'OperationOutcome',
'issue': [{
Expand Down

0 comments on commit 05e47cf

Please sign in to comment.