Apply review suggestions from @nilsding

Co-authored-by: Georg Gadinger <nilsding@nilsding.org>
This commit is contained in:
Andreas Nedbal 2022-12-27 23:36:40 +01:00
parent 44e144cecc
commit 481f3c4d8f
1 changed files with 0 additions and 4 deletions

View File

@ -16,19 +16,15 @@ class ShareWorker
rescue ActiveRecord::RecordNotFound
logger.info "Tried to post answer ##{answer_id} for user ##{user_id} to #{service.titleize} but the user/answer/service did not exist (likely deleted), will not retry."
# The question to be posted was deleted
nil
rescue Twitter::Error::DuplicateStatus
logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the status was already posted."
nil
rescue Twitter::Error::Forbidden
# User's Twitter account is suspended
logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the account is suspended."
nil
rescue Twitter::Error::Unauthorized
# User's Twitter token has expired or been revoked
# TODO: Notify user if this happens (https://github.com/Retrospring/retrospring/issues/123)
logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the token has exired or been revoked."
nil
rescue => e
logger.info "failed to post answer #{answer_id} to #{service} for user #{user_id}: #{e.message}"
Sentry.capture_exception(e)