Commit 3566fb4b authored by Fabio Pitino's avatar Fabio Pitino

Use a shared error class

parent 6367fa99
......@@ -10,6 +10,7 @@ module Ci
include HasRef
InvalidBridgeTypeError = Class.new(StandardError)
InvalidTransitionError = Class.new(StandardError)
belongs_to :project
belongs_to :trigger_request
......
......@@ -6,7 +6,6 @@ module Ci
include Gitlab::Utils::StrongMemoize
DuplicateDownstreamPipelineError = Class.new(StandardError)
InvalidBridgeTransition = Class.new(StandardError)
def execute(bridge)
@bridge = bridge
......@@ -55,7 +54,7 @@ module Ci
end
rescue StateMachines::InvalidTransition => e
Gitlab::ErrorTracking.track_exception(
InvalidBridgeTransition.new(e.message),
Ci::Bridge::InvalidTransitionError.new(e.message),
bridge_id: bridge.id,
downstream_pipeline_id: pipeline.id)
end
......
......@@ -8,7 +8,8 @@ module Ci
begin
pipeline.source_bridge.inherit_status_from_downstream!(pipeline)
rescue StateMachines::InvalidTransition => e
Gitlab::ErrorTracking.track_exception(e,
Gitlab::ErrorTracking.track_exception(
Ci::Bridge::InvalidTransitionError.new(e.message),
bridge_id: pipeline.source_bridge.id,
downstream_pipeline_id: pipeline.id)
end
......
......@@ -374,7 +374,7 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(
instance_of(Ci::CreateCrossProjectPipelineService::InvalidBridgeTransition),
instance_of(Ci::Bridge::InvalidTransitionError),
bridge_id: bridge.id,
downstream_pipeline_id: kind_of(Numeric))
......
......@@ -33,7 +33,7 @@ describe Ci::PipelineBridgeStatusService do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(
instance_of(StateMachines::InvalidTransition),
instance_of(Ci::Bridge::InvalidTransitionError),
bridge_id: bridge.id,
downstream_pipeline_id: pipeline.id)
......
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