Re: Adding Bonobo::GeneralError exception to Bonobo::Moniker::resolve ?



On 29Aug2001 05:47PM (+0200), Martin Baulig wrote:
> Hi Michael,
> 
> can we add a Bonobo::GeneralError exception or anything equivalent to
> the Bonobo::Moniker::resolve method ?

I strongly suggest having a more specific exception with a string
parameter rather than GeneralError for this case. How about adding a
Bonobo::IOError exception with a string argument or whatever.

 
> I need this for my ditem moniker and it may be useful for the other config
> monikers as well - when reading the file fails, I want to return an error
> message rather than just returning CORBA_OBJECT_NIL.
> 
> Currently, we have
> 
> =====
> #define EX_SET_NOT_FOUND(ev) bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound)
> 
> static Bonobo_Unknown
> ditem_resolve (BonoboMoniker               *moniker,
> 	       const Bonobo_ResolveOptions *options,
> 	       const CORBA_char            *requested_interface,
> 	       CORBA_Environment           *ev)
> {
> 	Bonobo_Moniker         parent;
> 	Bonobo_ConfigDatabase  db, pdb = CORBA_OBJECT_NIL;
> 	const gchar           *name;
> 
> 	if (strcmp (requested_interface, "IDL:Bonobo/ConfigDatabase:1.0")) {
> 		EX_SET_NOT_FOUND (ev);
> 		return CORBA_OBJECT_NIL; 
> 	}
> 
> 	parent = bonobo_moniker_get_parent (moniker, ev);
> 	if (BONOBO_EX (ev))
> 		return CORBA_OBJECT_NIL;
> 
> 	name = bonobo_moniker_get_name (moniker);
> 
> 
> 	if (parent != CORBA_OBJECT_NIL) {
> 
> 		pdb = Bonobo_Moniker_resolve (parent, options, 
> 					      "IDL:Bonobo/ConfigDatabase:1.0", 
> 					      ev);
>     
> 		bonobo_object_release_unref (parent, NULL);
> 		
> 		if (BONOBO_EX (ev) || pdb == CORBA_OBJECT_NIL)
> 			return CORBA_OBJECT_NIL;
> 
> 	}
> 
> 	if (!(db = bonobo_config_ditem_new (name, pdb, NULL))) {
> 		EX_SET_NOT_FOUND (ev);
> 		return CORBA_OBJECT_NIL; 
> 	}
> 
> 	return db;
> }
> ====
> 
> However, I don't think Bonobo::Moniker::InterfaceNotFound is the correct exception if
> the moniker interface could be found - but the requested file does not exist or is not
> in the correct format.
> 
> -- 
> Martin Baulig
> martin gnome org (private)
> baulig suse de (work)
> 
> _______________________________________________
> gnome-components-list mailing list
> gnome-components-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-components-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]