From: Ewan Mellor Subject: Re: [PATCH] suggested change in exception-handling style of user-space tools Date: Thu, 1 Jun 2006 12:11:33 +0100 Message-ID: <20060601111133.GG27649@leeni.uk.xensource.com> References: <1148401221.9142.17.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1586887998==" Return-path: In-Reply-To: <1148401221.9142.17.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel Miles Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1586887998== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 23, 2006 at 10:20:21AM -0600, Daniel Miles wrote: > In the tools/python/xen/xm directory, main.py has good error messages > that let the user know what failed; the other 'sub-command' classes > don't always have such good messages which can lead to some inexplicable > failures by the user-space tools. >=20 > Standard practice is to except each error by type and react accordingly > but in case the programmer does not anticipate a type of exception, > standard practice is to put in a catch-all exception handler that > excepts an 'Exception' object. Often in this case, the system will print > out the exception and exit. >=20 > If a sub-command excepts an 'Exception' object and the error is not > specific to that sub-command, it should pass the exception up for main > to handle. Especially in light of the fact that there is already a broad > collection of good error messages in main, I believe that this will lead > to better code re-use in the form of a one-stop-shop for error messages. > In this patch I've changed only one of the general case exception > handlers in one of the sub-commands (xm create) as a test-balloon to see > if the xen community will accept future patches of this type. Applied, thank you. Patches for cleaning up the error handling and diagnos= is are always welcome, so feel free to send more! > Singed-off-by: Daniel Miles I like the idea of a patch, gently burned around the edges ;-) Ewan. --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFEfstlThJ01fwmQlQRArzlAJ9m10O97zOy4vJarp1DfoPp2xSM2gCgi/mL MpqaYkAMdJMg6snGhkNlNGQ= =92c+ -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7-- --===============1586887998== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1586887998==--