Is there a way for something to raise and exception that does not descend from Exception?
What I’m trying to avoid is something like:
require 'timeout'
begin
timeout(1) {sleep(50)}
rescue StandardError => e
puts e.message
end
I know I can catch this with ‘rescue Exception’ or more drastically, ‘rescue Object’, but that seems a little odd to me.
If you try to raise an error that’s not of the
Exceptionclass, you’ll get a<TypeError: exception class/object expected>.