Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: first cut of hal service description file: msg#00201

freedesktop.dbus

Subject: Re: first cut of hal service description file

On Fri, 2005-04-01 at 00:23 +0200, Tako Schotanus wrote:
> Regardless of the fact if the exception is explicitly defined or not it
> is important to be able to figure out which exception has been thrown so
> that the caller can decide to handle it or to throw it up the chain. In
> what way will that be made possible? Because just one generic
> DBusException seems pretty useless. Or it will force you to write
> old-style code where return-values tell you if the method-call did its
> job or not (eg. did DeleteFile actually delete the file) and the
> exception will only tell you that something worse happened (eg. the bus
> went off-line, connection failure).

Just have subclasses, right? So the method signature is:

Foo() throws SuperClass;

But you have:

class SubClass1 extends SuperClass;
class SubClass2 extends SuperClass;

Then you can catch(SubClass1) if you want... isn't this allowed in most
languages?

It doesn't really work though, since there's no "IDL" to contain
SubClass1 - so I think in practice the answer is:

class DBusException {
boolean hasName(String name);
}

and the code is:

catch (DBusException e) {
if (e.hasName("org.freedesktop.Foo"))
// handle
else
throw e;
}

Kind of ugly, but it's the price of staying dynamic rather than static.

Havoc




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo