cloudfoundry/cloud_controller_ng

View on GitHub
app/actions/domain_update.rb

Summary

Maintainability
A
45 mins
Test Coverage
module VCAP::CloudController
  class DomainUpdate
    class InvalidDomain < StandardError
    end

    def initialize
      @logger = Steno.logger('cc.action.domain_update')
    end

    def update(domain:, message:)
      Domain.db.transaction do
        MetadataUpdate.update(domain, message)
      end

      @logger.info("Finished updating metadata on domain #{domain.guid}")

      domain
    rescue Sequel::ValidationFailed => e
      raise InvalidDomain.new(e.message)
    end
  end
end