Actions
Bug #14074
closedTracePoint#new without a block should not raise ThreadError
Bug #14074:
TracePoint#new without a block should not raise ThreadError
Actions
Added by atul (Atul Bhosale) almost 9 years ago. Updated over 8 years ago.
Is there an objection to change this to an ArgumentError?
I wouldn't be asking if the documentation wasn't mentioning it, but sadly it is.
I believe the reason it a ThreadError is raised is that:
$ grep "must be called with a block" *.c
thread.c: rb_raise(rb_eThreadError, "must be called with a block");
thread_sync.c: rb_raise(rb_eThreadError, "must be called with a block");
vm_trace.c: rb_raise(rb_eThreadError, "must be called with a block");
I don't believe there's actual cases in production of TracePoint.new being called without a black. Nevertheless, we might as well fix this.
So unless there's an objection, I will change the code to raise an ArgumentError and modify the documentation so it does not mention the class of error raised, like in the rest of the documentation.
FWIW, Thread.new and Mutex#synchronize raising ThreadError also seem wrong to be me.