Commit c30f8753 authored by Samir Noir's avatar Samir Noir 🧀
Browse files

Correctly use throw(:abort) to return false when uid is missing to start

a deployment
parent 338c3d50
......@@ -120,10 +120,8 @@ class DeploymentsController < ApplicationController
dpl.transform_blobs_into_files!(Rails.tmp, files_base_uri)
begin
unless dpl.launch
raise(ServerError, "#{dpl.errors.full_messages.join("; ")}")
throw :abort
end
dpl.launch || raise(ServerError,
"#{dpl.errors.full_messages.join("; ")}")
rescue Exception => e
raise ServerError, "Cannot launch deployment: #{e.message}"
end
......
......@@ -34,7 +34,10 @@ module Grid5000
before_save do
self.updated_at = Time.now.to_i
errors.add(:uid, "must be set") if uid.nil?
if uid.nil?
errors.add(:uid, "must be set")
throw(:abort)
end
errors.empty?
end
......
Supports Markdown
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