Commit 6196c991 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-log-lfs-push-failures' into 'master'

Log exceptions in Lfs::PushService

See merge request gitlab-org/gitlab!59960
parents 6cef2072 227e70b9
......@@ -17,11 +17,16 @@ module Lfs
success
rescue => err
Gitlab::ErrorTracking.log_exception(err, extra_context)
error(err.message)
end
private
def extra_context
{ project_id: project.id, user_id: current_user&.id }.compact
end
# Currently we only set repository_type for design repository objects, so
# push mirroring must send objects with a `nil` repository type - but if the
# wiki repository uses LFS, its objects will also be sent. This will be
......
---
title: Log exceptions in Lfs::PushService
merge_request: 59960
author:
type: changed
......@@ -63,6 +63,7 @@ RSpec.describe Lfs::PushService do
it 'returns a failure when submitting a batch fails' do
expect(lfs_client).to receive(:batch!) { raise 'failed' }
expect(Gitlab::ErrorTracking).to receive(:log_exception).and_call_original
expect(service.execute).to eq(status: :error, message: 'failed')
end
......@@ -70,6 +71,7 @@ RSpec.describe Lfs::PushService do
stub_lfs_batch(lfs_object)
expect(lfs_client).to receive(:upload!) { raise 'failed' }
expect(Gitlab::ErrorTracking).to receive(:log_exception).and_call_original
expect(service.execute).to eq(status: :error, message: 'failed')
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment