lib/vapir-ie/container.rb in vapir-ie-1.7.0 vs lib/vapir-ie/container.rb in vapir-ie-1.7.1.rc1
- old
+ new
@@ -19,10 +19,22 @@
# Is includable for classes that have @container, document and ole_inner_elements
module IE::Container
include Vapir::Container
include Vapir::Exception
+ public
+ # see documentation for the common Vapir::Container#handling_existence_failure
+ def handling_existence_failure(options={})
+ options=handle_options(options, :handle => :ignore)
+ begin
+ yield
+ rescue WIN32OLERuntimeError, RuntimeError, Vapir::Exception::ExistenceFailureException
+ raise if $!.class==RuntimeError && $!.message !~ /HRESULT/ # sometimes WIN32OLE raises a RuntimeError instead of a WIN32OLERuntimeError. only catch a RuntimeError if it's from WIN32OLE, indicated by HRESULT in the error message.
+ handle_existence_failure($!, options)
+ end
+ end
+ public
# Note: @container is the container of this object, i.e. the container
# of this container.
# In other words, for ie.table().this_thing().text_field().set,
# container of this_thing is the table.
@@ -39,13 +51,13 @@
# Write the specified string to the log.
def log(what)
@container.logger.debug(what) if @logger
end
- def set_container container
- @container = container
- @page_container = container.page_container
- end
+# def set_container container
+# @container = container
+# @page_container = container.page_container
+# end
private
end # module
end