Skip to content

Commit 4e50ebe

Browse files
committed
refac: ApiError is thrown in failed status during update
1 parent e0e5de7 commit 4e50ebe

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

app/actions/v3/service_instance_update_managed.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def update(accepts_incomplete: false)
113113
end
114114
rescue StandardError => e
115115
save_failed_state(service_instance, e)
116-
117116
raise e
118117
end
119118

@@ -140,7 +139,7 @@ def poll
140139
raise LastOperationFailedState.new(details[:last_operation][:description])
141140
end
142141
rescue LastOperationFailedState => e
143-
raise e
142+
raise CloudController::Errors::ApiError.new_from_details('UnableToPerform', 'update', e.message)
144143
rescue StandardError => e
145144
save_failed_state(service_instance, e)
146145
raise e

spec/unit/actions/v3/service_instance_update_managed_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ module V3
15221522
it 'raises and updates the last operation description' do
15231523
expect do
15241524
action.poll
1525-
end.to raise_error(VCAP::CloudController::V3::ServiceInstanceUpdateManaged::LastOperationFailedState)
1525+
end.to raise_error(CloudController::Errors::ApiError)
15261526

15271527
expect(ServiceInstance.first.last_operation.type).to eq('update')
15281528
expect(ServiceInstance.first.last_operation.state).to eq('failed')

0 commit comments

Comments
 (0)