Raising lots of exceptions: Bad style?

This is a simple implementation of a knapsack written in ruby. I’ve included all the relevant code here, but my question is concerning the contents setter .contents=

## item.rb class Item   attr_accessor :weight    def initialize(weight:, data: nil)     @weight = weight     @data   = data   end  end   ## knapsack.rb class KnapsackCapacityExceededError < StandardError; end class KnapsackWeightExceededError < StandardError; end class KnapsackContentError < StandardError; end  class Knapsack   attr_reader :capacity   attr_reader :weight   attr_reader :contents    def initialize(capacity:, weight:)     @capacity = capacity     @weight   = weight     @contents = Array.new(@capacity) { nil }   end    def contents=(new_contents)     raise KnapsackCapacityExceededError if new_contents.length >= self.capacity     raise KnapsackWeightExceededError   if new_contents.map {|item| item.weight }.sum >= self.weight     raise KnapsackContentError          if new_contents.all? { |e| e.is_a? Item }      @contents = new_contents   end  end  # k = Knapsack.new(capacity: 10, weight: 50) 

In this method there are three conditions where an exception is raised, is this a code smell?

Any other feedback also appreciated.