From c4a125d9747c83fde81074768071567a4266e828 Mon Sep 17 00:00:00 2001 From: John Costa Date: Wed, 18 Nov 2026 15:07:07 -0800 Subject: [PATCH] Pass the message through in Channel::ValidationError initialize set a default message but never called super, so the message was always the class name. --- lib/concurrent-ruby-edge/concurrent/channel.rb | 1 + spec/concurrent/channel_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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