Author: aschnell Date: Mon Aug 13 21:01:13 2007 New Revision: 6634 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6634&view=rev Log: - added exception example Added: trunk/libzypp-bindings/examples/ruby/exception.rb Added: trunk/libzypp-bindings/examples/ruby/exception.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/examples/ruby/exception.rb?rev=6634&view=auto ============================================================================== --- trunk/libzypp-bindings/examples/ruby/exception.rb (added) +++ trunk/libzypp-bindings/examples/ruby/exception.rb Mon Aug 13 21:01:13 2007 @@ -0,0 +1,34 @@ + +require 'rzypp' +include Rzypp + +tmp_cache_path = TmpDir.new() +tmp_raw_cache_path = TmpDir.new() +tmp_known_repos_path = TmpDir.new() + +opts = RepoManagerOptions.new() +opts.repoCachePath = tmp_cache_path.path() +opts.repoRawCachePath = tmp_raw_cache_path.path() +opts.knownReposPath = tmp_known_repos_path.path() + +repo_manager = RepoManager.new(opts) + +repo_info = RepoInfo.new() + +repo_info.set_alias("factorytest") +repo_info.set_name("Test Repo for Factory.") +repo_info.set_enabled(true) +repo_info.set_autorefresh(false) +repo_info.add_base_url("file:///tmp/does-not-exist") + +begin + repo_manager.add_repository(repo_info) + repo_manager.refresh_metadata(repo_info) + repo_manager.build_cache(repo_info) +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception" +end + -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org