Skip to content

Commit

Permalink
Sentry clean-up: replace sentry with error and warning logs
Browse files Browse the repository at this point in the history
* When re-use an orphaned version
* When creation fails due to unpublished pending version exists
  • Loading branch information
cslzchen committed Jan 20, 2025
1 parent d0b71f3 commit 1db82d7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions osf/models/preprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,16 @@ def create_version(cls, create_from_guid, auth):
raise PermissionsError
unfinished_version, unpublished_version = latest_version.check_unfinished_or_unpublished_version()
if unpublished_version:
sentry.log_message('Failed to create a new version due to unpublished pending version already exists: '
f'[version={unpublished_version.version}, '
f'_id={unpublished_version._id}, '
f'state={unpublished_version.machine_state}].')
logger.error('Failed to create a new version due to unpublished pending version already exists: '
f'[version={unpublished_version.version}, '
f'_id={unpublished_version._id}, '
f'state={unpublished_version.machine_state}].')
raise UnpublishedPendingPreprintVersionExists
if unfinished_version:
sentry.log_message(f'Use existing initiated but unfinished version instead of creating a new one: '
f'[version={unfinished_version.version}, '
f'_id={unfinished_version._id}, '
f'state={unfinished_version.machine_state}].')
logger.warning(f'Use existing initiated but unfinished version instead of creating a new one: '
f'[version={unfinished_version.version}, '
f'_id={unfinished_version._id}, '
f'state={unfinished_version.machine_state}].')
return unfinished_version, None

# Note: version number bumps from the last version number instead of the latest version number
Expand Down

0 comments on commit 1db82d7

Please sign in to comment.