def raise_up_common(force, *args)
exception = if args == []
last_exception || RuntimeError.new
elsif args.length == 1 && args.first.is_a?(String)
RuntimeError.new(args.first)
elsif args.length > 3
raise ArgumentError, "wrong number of arguments"
elsif !args.first.respond_to?(:exception)
raise TypeError, "exception class/object expected"
elsif args.length === 1
args.first.exception
else
args.first.exception(args[1])
end
raise TypeError, "exception object expected" unless exception.is_a? Exception
exception.set_backtrace(args.length === 3 ? args[2] : caller(1))
if force || binding_stack.one?
binding_stack.clear
throw :raise_up, exception
else
binding_stack.pop
raise exception
end
end