[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [Subclipse-dev] Revision graph status and plan

From: Steve Elsemore <selsemore_at_collab.net>
Date: Mon, 22 Sep 2008 11:20:05 -0700

We are unfortunately a bit inconsistent in our exception handling. Quite
often exceptions are handled like this:

MessageDialog.openError(shell, title, exception.getMessage());

Depending on where the error is caught, shell might be resolved in various
ways. In your example below, getSite().getShell() is used. As a fallback
you can use Display().getDefault().getActiveShell().

Usually title matches the title of the action that resulted in the
exception. For example, if the "View file history as graph" menu option
resulted in an exception, "View file history as graph" would be the title
for the error dialog. The exception message would be the dialog text.

Using MessageDialog.openError is safe if you know the exception is in the UI
thread. SVNUIPlugin.openError is better because it will handle an exception
regardless of where it occurs. You still might consider using a title that
matches the action that resulted in the exception (instead of "Error"), but
I guess that's a matter of opinion.

So, to answer your question, yes that is the way to handle exceptions, even
though it's not consistently used throughout the UI.

On 9/22/08 10:29 AM, "Alberto Gimeno" <gimenete_at_gmail.com> wrote:

> Is this the correct way to handle exceptions in the UI?
>
> SVNUIPlugin.openError(getSite().getShell(), "Error", "Error while
> showing the graph", exception);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subclipse.tigris.org
For additional commands, e-mail: dev-help_at_subclipse.tigris.org
Received on 2008-09-22 20:20:20 CEST

This is an archived mail posted to the Subclipse Dev mailing list.