Re: [java-gnome-hackers] Should Pixbuf constructor propegate unchecked excpetion for unknown format
Brought to you by:
afcowie
From: Vreixo F. L. <met...@ya...> - 2008-06-16 10:03:50
|
Hi! --- Em seg, 16/6/08, Andrew Cowie <an...@op...> escreveu: > These crop up when, for one example, there is an > "Unrecognized image > file format". That certainly shouldn't be so vague > as a > RuntimeException, and now that I'm running into them > I'm not entirely > convinced it should be unchecked. > > So, checked or unchecked? And, which particular exception > for this case? > If checked, IOException? If unchecked, the ever-trusty > IllegalArgumentException? Good question. The fast answer: if only programmer errors can lead to that exception, then unchecked, On the other side, if the user interaction can cause such exception, then checked, to forced programmers to catch it and report it to the user. The problem is that, in my apps, I always use Pixbuf for UI images that are packaged together with the application. Thus, this fits in the first case (programmer errors, maybe configuration errors in this case), and thus unchecked seems better. However, I wonder if somebody may be using Pixbuf for load images supplied by user, For example, an image viewer or picture catalog image may use Pixbuf for that. In those case checked is better. > > [This is another instance where the lack of specificity of > our wrapping > GError is turning up. I have a feeling we need to start > passing some > identifiers or Constants through with error domain and the > specific > error enum so that the Java side code can, when the error > is > understandable, raise something a bit more appropriate] Yes, that's a thing I've planned. The error code needs to be exposed, together with [at least] the most common error codes, as enums. Maybe just as static fields of GlibException. I can take care of this next days (I'm a bit busy, as always, but...). Cheers Vreixo Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento! http://br.mail.yahoo.com/ |