Commit a10d7c4f authored by Serena Fang's avatar Serena Fang Committed by Thong Kuah

Add rails logger to debug EKS errors

Just rescuing the error and responding with 422 unprocessable entity
makes debugging AWS authentication errors difficult, so add a Rails
logger so the specific error message shows up in the dev logs
parent 8fc5347f
...@@ -23,7 +23,9 @@ module Clusters ...@@ -23,7 +23,9 @@ module Clusters
@role = create_or_update_role! @role = create_or_update_role!
Response.new(:ok, credentials) Response.new(:ok, credentials)
rescue *ERRORS rescue *ERRORS => e
Gitlab::ErrorTracking.track_exception(e)
Response.new(:unprocessable_entity, {}) Response.new(:unprocessable_entity, {})
end end
......
...@@ -53,6 +53,12 @@ RSpec.describe Clusters::Aws::AuthorizeRoleService do ...@@ -53,6 +53,12 @@ RSpec.describe Clusters::Aws::AuthorizeRoleService do
expect(subject.status).to eq(:unprocessable_entity) expect(subject.status).to eq(:unprocessable_entity)
expect(subject.body).to eq({}) expect(subject.body).to eq({})
end end
it 'logs the error' do
expect(::Gitlab::ErrorTracking).to receive(:track_exception)
subject
end
end end
context 'cannot create role' do context 'cannot create role' do
......
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