diff --git a/lib/concurrent-ruby-edge/concurrent/channel.rb b/lib/concurrent-ruby-edge/concurrent/channel.rb index 36f0c1e55..845b59cda 100644 --- a/lib/concurrent-ruby-edge/concurrent/channel.rb +++ b/lib/concurrent-ruby-edge/concurrent/channel.rb @@ -34,6 +34,7 @@ class Channel class ValidationError < Error def initialize(message = nil) message ||= 'invalid value' + super(message) end end diff --git a/spec/concurrent/channel_spec.rb b/spec/concurrent/channel_spec.rb index d5c442a56..8350cfdbd 100644 --- a/spec/concurrent/channel_spec.rb +++ b/spec/concurrent/channel_spec.rb @@ -162,7 +162,7 @@ module Concurrent subject = Channel.new(capacity: 10, validator: validator) expect{ subject.put!(42) - }.to raise_error(Channel::ValidationError) + }.to raise_error(Channel::ValidationError, 'invalid value') end it 'rejects when the validator raises an exception' do @@ -176,7 +176,7 @@ module Concurrent it 'rejects nil' do expect { subject.put!(nil) - }.to raise_error(Channel::ValidationError) + }.to raise_error(Channel::ValidationError, 'nil is not a valid value') end end