Author: lslezak Date: Wed Jul 30 11:53:26 2008 New Revision: 49509 URL: http://svn.opensuse.org/viewcvs/yast?rev=49509&view=rev Log: - Pkg::Connect() - set LastError() (bnc#280537) Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/PkgFunctions.cc Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=49509&r1=49508&r2=49509&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Wed Jul 30 11:53:26 2008 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Wed Jul 30 11:52:01 CEST 2008 - lslezak@suse.cz + +- Pkg::Connect() - set LastError() (bnc#280537) + +------------------------------------------------------------------- Wed Jul 30 10:41:19 CEST 2008 - lslezak@suse.cz - allow priority >99 in Pkg::SourceSet() (bnc#402135) Modified: trunk/pkg-bindings/src/PkgFunctions.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.cc?rev=49509&r1=49508&r2=49509&view=diff ============================================================================== --- trunk/pkg-bindings/src/PkgFunctions.cc (original) +++ trunk/pkg-bindings/src/PkgFunctions.cc Wed Jul 30 11:53:26 2008 @@ -92,8 +92,13 @@ zypp_pointer = zypp::getZYpp(); return zypp_pointer; } - catch (...) + catch (const zypp::Exception &excpt) { + // is it the last attempt? + if (max_count == 1) + { + ZYPP_RETHROW(excpt); + } } max_count--; @@ -104,8 +109,12 @@ } } - // still not initialized, throw an exception - ZYPP_THROW (zypp::Exception(std::string("Cannot connect to the package manager"))); + if (zypp_pointer == NULL) + { + // still not initialized, throw an exception + // translators: this is an error message + ZYPP_THROW (zypp::Exception(std::string(_("Cannot connect to the package manager")))); + } return zypp_pointer; } @@ -143,8 +152,15 @@ { return YCPBoolean(zypp_ptr() != NULL); } - catch(...) + catch(const zypp::ZYppFactoryException &excpt) + { + y2error("Error in Connect: FactoryException: %s", excpt.asString().c_str()); + _last_error.setLastError(excpt.asString()); + } + catch (const zypp::Exception& excpt) { + y2error("Error in Connect: Exception: %s", excpt.asString().c_str()); + _last_error.setLastError(ExceptionAsString(excpt)); } return YCPBoolean(false); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org