Pathname location = service.filepath();
if( location.empty() )
{
- ZYPP_THROW(RepoException( _("Can't figure out where the service is stored.") ));
+ ZYPP_THROW(ServiceException( _("Can't figure out where the service is stored.") ));
}
ServiceSet tmpSet;
if ( filesystem::unlink(location) != 0 )
{
// TranslatorExplanation '%s' is a filename
- ZYPP_THROW(RepoException(str::form( _("Can't delete '%s'"), location.c_str() )));
+ ZYPP_THROW(ServiceException(str::form( _("Can't delete '%s'"), location.c_str() )));
}
MIL << alias << " sucessfully deleted." << endl;
}
if ( service.type() == ServiceType::PLUGIN )
{
- WAR << "Not modifying plugin service '" << oldAlias << "'" << endl;
- return;
+ ZYPP_THROW(ServicePluginImmutableException());
}
const ServiceInfo & oldService = getService(oldAlias);
Pathname location = oldService.filepath();
if( location.empty() )
{
- ZYPP_THROW(RepoException( _("Can't figure out where the service is stored.") ));
+ ZYPP_THROW(ServiceException( _("Can't figure out where the service is stored.") ));
}
// remember: there may multiple services being defined in one file:
#include <iostream>
#include "zypp/repo/RepoException.h"
#include "zypp/base/String.h"
+#include "zypp/base/Gettext.h"
using std::endl;
///////////////////////////////////////////////////////////////////
#define DEF_CTORS( CLASS, MSG ) \
- CLASS::CLASS() : ServiceException( MSG ) {} \
- CLASS::CLASS( const std::string & msg_r ) : ServiceException( msg_r ) {} \
- CLASS::CLASS( const ServiceInfo & service_r ) : ServiceException( service_r, MSG ) {} \
- CLASS::CLASS( const ServiceInfo & service_r, const std::string & msg_r ) : ServiceException( service_r, msg_r ) {}
+ CLASS::CLASS() : DEF_BASECLASS( MSG ) {} \
+ CLASS::CLASS( const std::string & msg_r ) : DEF_BASECLASS( msg_r ) {} \
+ CLASS::CLASS( const ServiceInfo & service_r ) : DEF_BASECLASS( service_r, MSG ) {} \
+ CLASS::CLASS( const ServiceInfo & service_r, const std::string & msg_r ) : DEF_BASECLASS( service_r, msg_r ) {}
+#define DEF_BASECLASS ServiceException
DEF_CTORS( ServiceNoAliasException, "Service has no alias defined." );
DEF_CTORS( ServiceInvalidAliasException, "Service has an invalid alias." );
DEF_CTORS( ServiceAlreadyExistsException, "Service already exists." );
DEF_CTORS( ServiceNoUrlException, "Service has no or invalid url defined." );
- DEF_CTORS( ServicePluginInformalException,"Service plugin has trouble providing the metadata but this should not be treated as error." );
-#undef DEF_CTORS
+ // sub classes:
+ DEF_CTORS( ServicePluginException, "PLUGIN service exception." );
+
+ ///////////////////////////////////////////////////////////////////
+ // sub class: ServicePluginException
+#undef DEF_BASECLASS
+#define DEF_BASECLASS ServicePluginException
+ DEF_CTORS( ServicePluginInformalException, "Service plugin has trouble providing the metadata but this should not be treated as error." );
+ DEF_CTORS( ServicePluginImmutableException, _("Service plugin does not support changing an attribute.") );
+#undef DEF_CTORS
/////////////////////////////////////////////////////////////////
} // namespace repo
///////////////////////////////////////////////////////////////////
ServiceNoUrlException( const ServiceInfo & service_r );
ServiceNoUrlException( const ServiceInfo & service_r, const std::string & msg_r );
};
+ //@}
+
+
+ /** \name PLUGIN Service related exceptions.
+ */
+ //@{
+
+ /** PLUGIN Service related exceptions
+ */
+ class ServicePluginException : public ServiceException
+ {
+ public:
+ ServicePluginException();
+ ServicePluginException( const std::string & msg_r );
+ ServicePluginException( const ServiceInfo & service_r );
+ ServicePluginException( const ServiceInfo & service_r, const std::string & msg_r );
+ };
/** Service plugin has trouble providing the metadata but this should not be treated as error.
*/
- class ServicePluginInformalException : public ServiceException
+ class ServicePluginInformalException : public ServicePluginException
{
public:
ServicePluginInformalException();
ServicePluginInformalException( const ServiceInfo & service_r, const std::string & msg_r );
};
+ /** Service plugin is immutable.
+ */
+ class ServicePluginImmutableException : public ServicePluginException
+ {
+ public:
+ ServicePluginImmutableException();
+ ServicePluginImmutableException( const std::string & msg_r );
+ ServicePluginImmutableException( const ServiceInfo & service_r );
+ ServicePluginImmutableException( const ServiceInfo & service_r, const std::string & msg_r );
+ };
//@}
/////////////////////////////////////////////////////////////////