Commit ab23a865 authored by mo khan's avatar mo khan Committed by Ash McKenzie

Collapse begin/rescue into method

parent ca1e2f89
......@@ -11,14 +11,11 @@ module SoftwareLicensePolicies
return error("", 403) unless can?(@current_user, :admin_software_license_policy, @project)
return success(software_license_policy: software_license_policy) unless params[:approval_status].present?
begin
software_license_policy.update(classification: map_from(params[:approval_status]))
RefreshLicenseComplianceChecksWorker.perform_async(project.id)
rescue ArgumentError => ex
return error(ex.message, 400)
end
software_license_policy.update(classification: map_from(params[:approval_status]))
RefreshLicenseComplianceChecksWorker.perform_async(project.id)
success(software_license_policy: software_license_policy)
rescue ArgumentError => ex
error(ex.message, 400)
end
private
......
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